ó
    €Ï;
  ã                   ó†   • 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   " S	 S
\R                  5      rg)z%Add IAM Policy Binding for EkmConfig.é    )Úabsolute_import)Údivision)Úunicode_literals)Úiam)Úbase)Úiam_util)Úresource_argsc                   ó.   • \ rS rSrSr\S 5       rS rSrg)ÚAddIamPolicyBindingé   aÁ  Add IAM policy binding to an EkmConfig.

Adds a policy binding to the IAM policy of a kms EkmConfig. A binding consists
of at least one member, a role, and an optional condition.

## EXAMPLES
To add an IAM policy binding for the role of 'roles/editor' for the user
`test-user@gmail.com` on the EkmConfig with location `us-central1`, run:

  $ {command} --location='us-central1' --member='user:test-user@gmail.com'
  --role='roles/editor'

To add an IAM policy binding which expires at the end of the year 2022 for the
role of 'roles/editor' and the user `test-user@gmail.com` and location
`us-central1`, run:

  $ {command} --location='us-central1' --member='user:test-user@gmail.com'
  --role='roles/editor' --condition='expression=request.time <
  timestamp("2023-01-01T00:00:00Z"),title=expires_end_of_2022,description=Expires
  at midnight on 2022-12-31'

See https://cloud.google.com/iam/docs/managing-policies for details of
policy role and member types.
c                 ó^   • [         R                  " U SS5        [        R                  " U SS9  g )NTz
--location)Úadd_condition)r	   ÚAddKmsLocationResourceArgForKMSr   ÚAddArgsForAddIamPolicyBinding)Úparsers    Ú4lib/surface/kms/ekm_config/add_iam_policy_binding.pyÚArgsÚAddIamPolicyBinding.Args5   s$   € ä×1Ò1°&¸$ÀÔMÜ×*Ò*¨6ÀÓFó    c                 ó  • UR                   R                  R                  5       nSR                  UR                  UR
                  5      n[        R                  " X1R                  UR                  5      n[        R                  " US5        U$ )Nz$projects/{0}/locations/{1}/ekmConfigÚ	EkmConfig)ÚCONCEPTSÚlocationÚParseÚformatÚ
projectsIdÚlocationsIdr   ÚAddPolicyBindingToEkmConfigÚmemberÚroler   ÚLogSetIamPolicy)ÚselfÚargsÚlocation_refÚekm_config_nameÚresults        r   ÚRunÚAddIamPolicyBinding.Run:   sm   € Ø—=‘=×)Ñ)×/Ñ/Ó1€LØ<×CÑCØ×Ñ ×!9Ñ!9ó;€Oä×,Ò,¨_¿k¹kØ-1¯Y©Yó8€Fä×Ò˜_¨kÔ:Ø€Mr   © N)	Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__Ústaticmethodr   r'   Ú__static_attributes__r)   r   r   r   r      s"   † ñð2 ñGó ðGõr   r   N)r.   Ú
__future__r   r   r   Úgooglecloudsdk.api_lib.cloudkmsr   Úgooglecloudsdk.callioper   Úgooglecloudsdk.command_lib.iamr   Úgooglecloudsdk.command_lib.kmsr	   ÚCommandr   r)   r   r   Ú<module>r7      s/   ðñ ,å &Ý Ý 'å /Ý (Ý 3Ý 8ô&˜$Ÿ,™,õ &r   