
    N                     |   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SK
Jr  SSKJr  \	R                  \	R                   " \	R"                  R$                  5       " S	 S
\	R&                  5      5       5       r\	R                  \	R                   " \	R"                  R*                  5       " S S\5      5       5       rg)z Set the IAM policy for a secret.    )absolute_import)division)unicode_literals)api)base)iam_util)argsc                   6    \ rS rSrSrSS0r\S 5       rS rSr	g)	SetIamPolicy   zSet the IAM policy binding for a secret.

Sets the IAM policy for the given secret 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.
EXAMPLESz          The following command will read an IAM policy defined in a JSON file
    'policy.json' and set it for the secret 'my-secret':

        $ {command} my-secret policy.json
          c                    [         R                  " U SSSSS9  [         R                  " U SSS9  [        R                  " U 5        [
        R                  R                  U 5        [
        R                  R                  U 5        [
        R                  R                  U 5        [
        R                  R                  U 5        [
        R                  R                  U 5        g )N Tz3Name of the secret for which to set the IAM policy.)purpose
positionalrequired	help_textzto set iam policyF)r   hidden)secrets_args	AddSecretAddLocationr   AddArgForPolicyFiler   URI_FLAGRemoveFromParserFILTER_FLAG
LIMIT_FLAGPAGE_SIZE_FLAGSORT_BY_FLAG)parsers    %lib/surface/secrets/set_iam_policy.pyArgsSetIamPolicy.Args/   s    G V-@O  (MM""6*%%f-OO$$V,((0&&v.    c                    [         R                  " U R                  5       5      nUR                  R                  R                  5       n[         R                  " US9n[        R                  " UR                  UR                  5      u  pV[         R                  " US9R                  X5XaR                  S9n[        R                  " UR                  5       S5        U$ )N)version)api_version)secret_locationsecret)secrets_apiGetApiFromTrackReleaseTrackCONCEPTSr(   ParseGetMessagesr   ParseYamlOrJsonPolicyFilepolicy_filePolicySecretsr   locationLogSetIamPolicyName)selfr	   r&   
secret_refmessagespolicyupdate_maskresults           r    RunSetIamPolicy.Run@   s    --d.?.?.ABK%%++-J&&{;H"<<(//F   [9FFK G F Z__.9Mr#    N)
__name__
__module____qualname____firstlineno____doc__detailed_helpstaticmethodr!   r<   __static_attributes__r>   r#   r    r   r      s1      - / / r#   r   c                        \ rS rSrSrSS0rSrg)SetIamPolicyBetaN   zSet the IAM policy for a secret.

Sets the IAM policy for the given secret.

Returns an empty policy if the resource does not have a policy
set.
r   z|          To print the IAM policy for secret named 'my-secret', run:

        $ {command} my-secret [--location=]
          r>   N)r?   r@   rA   rB   rC   rD   rF   r>   r#   r    rH   rH   N   s      -r#   rH   N)rC   
__future__r   r   r   googlecloudsdk.api_lib.secretsr   r)   googlecloudsdk.callioper   googlecloudsdk.command_lib.iamr   "googlecloudsdk.command_lib.secretsr	   r   DefaultUniverseOnlyReleaseTracksr+   GAListCommandr   BETArH   r>   r#   r    <module>rT      s    ' &  ' = ( 3 C D%%(().4## . * .b D%%**+|  , r#   