
    |                        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 ddl	m
Z
 ddlmZ dd	lmZ  e
j                  e
j                   j"                         G d
 de
j$                               Z e
j                  e
j                   j(                         G d de
j$                               Z e
j                  e
j                   j,                         G d de
j$                               Zy)z/gcloud dns managed-zone set-iam-policy command.    )absolute_import)division)unicode_literals)util)apis)base)flags)iam_utilc                   &    e Zd ZdZed        Zd Zy)SetIamPolicyAlphaSet the IAM policy for a Cloud DNS managed-zone.

  This command sets the IAM policy of the specified managed-zone.

  ## EXAMPLES

  To set the IAM policy of your managed-zone , run:

    $ {command} my-zone --policy-file=policy.json
  c                 t    t        j                  d      j                  |        | j                  ddd       y Nz7The name of the managed-zone to set the IAM policy for.z--policy-fileTz%JSON or YAML file with the IAM policy)requiredhelpr	   GetZoneResourceArgAddToParseradd_argumentparsers    /lib/surface/dns/managed_zones/set_iam_policy.pyArgszSetIamPolicyAlpha.Args)   >    	ACCN;D
4  6    c                 
   t        j                  | j                               }t        j                  |      }t	        j
                  d|      }|j                  j                  j                         }dj                  |j                  |j                        }t        j                  |j                  |j                        \  }}|j!                  ||j#                  ||            }	|j$                  j'                  |	      S )Ndnszprojects/{0}/managedZones/{1}policy
updateMaskresourcegoogleIamV1SetIamPolicyRequest)r   GetApiFromTrackReleaseTrackGetApiClientr   GetMessagesModuleCONCEPTSzoneParseformatprojectmanagedZoner
   ParsePolicyFileWithUpdateMaskpolicy_fileGoogleIamV1Policy*DnsProjectsManagedZonesSetIamPolicyRequestGoogleIamV1SetIamPolicyRequestprojects_managedZonesSetIamPolicy
selfargsapi_version
dns_clientmessageszone_refresource_namer   update_maskreqs
             r   RunzSetIamPolicyAlpha.Run3   s    &&t'8'8':;K"";/J%%e[9H}}!!'')H3::(..0M"@@(446FK 
=
='/'N'Nk (O (3 > 4C
 ++88==r   N__name__
__module____qualname____doc__staticmethodr   r?    r   r   r   r      s     	 6 6>r   r   c                   &    e Zd ZdZed        Zd Zy)SetIamPolicyBetar   c                 t    t        j                  d      j                  |        | j                  ddd       y r   r   r   s    r   r   zSetIamPolicyBeta.ArgsR   r   r   c                    d}t        j                  |      }t        j                  d|      }|j                  j
                  j                         }dj                  |j                  d|j                        }t        j                  |j                  |j                        \  }}|j                  ||j                  ||            }	|j                   j#                  |	      S Nv2r   z+projects/{0}/locations/{1}/managedZones/{2}globalr   r!   r   r&   r   r'   r(   r)   r*   r+   r,   r-   r
   r.   r/   r0   "DnsManagedZonesSetIamPolicyRequestr2   managedZonesr4   r5   s
             r   r?   zSetIamPolicyBeta.Run\       K"";/J%%e[9H}}!!'')HAHH(H$8$8:M"@@(446FK 
5
5'/'N'Nk (O (3 6 4C
 ""//44r   Nr@   rF   r   r   rH   rH   E        	 6 65r   rH   c                   &    e Zd ZdZed        Zd Zy)SetIamPolicyGAr   c                 t    t        j                  d      j                  |        | j                  ddd       y r   r   r   s    r   r   zSetIamPolicyGA.Args|   r   r   c                    d}t        j                  |      }t        j                  d|      }|j                  j
                  j                         }dj                  |j                  d|j                        }t        j                  |j                  |j                        \  }}|j                  ||j                  ||            }	|j                   j#                  |	      S rK   rN   r5   s
             r   r?   zSetIamPolicyGA.Run   rQ   r   Nr@   rF   r   r   rT   rT   o   rR   r   rT   N)rD   
__future__r   r   r   googlecloudsdk.api_lib.dnsr   googlecloudsdk.api_lib.utilr   googlecloudsdk.callioper   googlecloudsdk.command_lib.dnsr	   googlecloudsdk.command_lib.iamr
   ReleaseTracksr%   ALPHACommandr   BETArH   GArT   rF   r   r   <module>rb      s    6 &  ' + , ( 0 3 D%%++,%> %> -%>P D%%**+&5t|| &5 ,&5R D%%(()&5T\\ &5 *&5r   