
                             d Z ddlmZ ddlmZ ddlmZ ddlm	Z	 ddl
mZ  ej                  ej                  j                        ej                  ej                    G d dej"                                             Zy	)
zB`gcloud dataplex governance-rules set-iam-policy-binding` command.    )governance_rule)
exceptions)base)resource_args)iam_utilc                   X    e Zd ZdZddiZed        Z ej                  d      d        Z	y)SetIamPolicyzSet an IAM policy binding for a Dataplex Governance Rule as defined in a JSON or YAML file.

  See https://cloud.google.com/iam/docs/managing-policies for details of
    the policy file format and contents.
  EXAMPLESa  
          The following command will read an IAM policy defined in a JSON file
          `policy.json` and set it for the Dataplex Governance Rule `test-governance-rule` in
          project `test-project` and in location `us-central1`:

            $ {command} test-governance-rule --project=test-project --location=us-central1 policy.json

            where policy.json is the relative path to the JSON file.

          c                 Z    t        j                  | d       t        j                  |        y )Nzto set IAM policy to.)r   AddGovernanceRuleResourceArgr   AddArgForPolicyFile)parsers    7lib/surface/dataplex/governance_rules/set_iam_policy.pyArgszSetIamPolicy.Args0   s!    ..v7NO  (    z-Status code: {status_code}. {status_message}.c                     |j                   j                  j                         }t        j                  ||j                        }|S )N)CONCEPTSr   ParseSetIamPolicyFromFilepolicy_file)selfargsgovernance_rule_refresults       r   RunzSetIamPolicy.Run5   s?     --77==?11T--F Mr   N)
__name__
__module____qualname____doc__detailed_helpstaticmethodr   gcloud_exception CatchHTTPErrorRaiseHTTPExceptionr    r   r   r	   r	      sQ      
- ) ) 5445r   r	   N)r   googlecloudsdk.api_lib.dataplexr   googlecloudsdk.api_lib.utilr   r"   googlecloudsdk.callioper   #googlecloudsdk.command_lib.dataplexr   googlecloudsdk.command_lib.iamr   ReleaseTracksReleaseTrackALPHADefaultUniverseOnlyHiddenCommandr	   r$   r   r   <module>r0      sl    I ; F ( = 3 D%%++,"4<< "   -"r   