
    f                     V    S r SSKJr  SSKJr  SSKJr  SSKJr  SSKJr  S r	S r
S	 rg
)z.Shared resource flags for datafusion commands.    )absolute_import)division)unicode_literals)iam_util)
console_ioc                     [         R                  " U U5      u  p#UR                  (       d  Sn[        R                  " USSS9  U$ )ay  Constructs an IAM Policy message from a JSON/YAML formatted file.

Args:
  policy_file_path: Path to the JSON or YAML IAM policy file.
  policy_message_type: Policy message type to convert JSON or YAML to.
Returns:
  a protorpc.Message of type policy_message_type filled in from the JSON or
  YAML policy file.
Raises:
  BadFileException if the JSON or YAML file is malformed.
zThe specified policy does not contain an "etag" field identifying a specific version to replace. Changing a policy without an "etag" can overwrite concurrent policy changes.zReplace existing policyT)messageprompt_stringcancel_on_no)r   ParseYamlOrJsonPolicyFileetagr   PromptContinue)policy_file_pathpolicy_message_typepolicyunused_maskmsgs        Blib/googlecloudsdk/command_lib/data_fusion/data_fusion_iam_util.pyParsePolicyFiler      sK     !::& 
C #<4Q	-    c                 6   U(       aM  UR                  U R                  5       < SU< 3UR                  US9S9nUR                  R	                  U5      $ UR                  U R                  5       UR                  US9S9nUR                  R	                  U5      $ )z4Sets IAM policy for a given instance or a namespace.z/namespaces/)r   )resourcesetIamPolicyRequest)ADatafusionProjectsLocationsInstancesNamespacesSetIamPolicyRequestRelativeNameSetIamPolicyRequest'projects_locations_instances_namespacesSetIamPolicy7DatafusionProjectsLocationsInstancesSetIamPolicyRequestprojects_locations_instances)instance_ref	namespacenew_iam_policymessagesclientpolicy_requests         r   DoSetIamPolicyr'   3   s     __'3'@'@'BIN$88! 9 # ` $N 99FF  UU**,$88! 9 # V $N ..;;NKKr   c                 &    U R                  SSSS9  g )Npolicy_filePOLICY_FILEa           Path to a local JSON or YAML file containing a valid policy.

        The output of the `get-iam-policy` command is a valid file, as is any
        JSON or YAML file conforming to the structure of a
        [Policy](https://cloud.google.com/iam/reference/rest/v1/Policy).
        )metavarhelp)add_argument)parsers    r   AddPolicyFileArgr/   H   s       	r   N)__doc__
__future__r   r   r   googlecloudsdk.command_lib.iamr   googlecloudsdk.core.consoler   r   r'   r/    r   r   <module>r5      s)    5 &  ' 3 24L*
r   