
    P
                     l    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	 rSS jrg
)z-Helpers for dealing with the Private CA P4SA.    )absolute_import)division)unicode_literals)iam)base)serviceusage)storage_apic                     [         R                  " 5       n[        R                  " U R	                  5       U5      nUS   $ )a^  Gets (or creates) the P4SA for Private CA in the given project.

If the P4SA does not exist for this project, it will be created. Otherwise,
the email address of the existing P4SA will be returned.

Args:
  project_ref: resources.Resource reference to the project for the P4SA.

Returns:
  Email address of the Private CA P4SA for the given project.
email)privateca_baseGetServiceNamer   GenerateServiceIdentityName)project_refservice_nameresponses      0lib/googlecloudsdk/command_lib/privateca/p4sa.pyGetOrCreater      s<      ..0,11+2B2B2D2>@(	'	    Nc                     SR                  U 5      nU(       a  [        R                  " XS4US4/5        U(       a-  [        R                  " 5       nUR                  X#S4US4/5        gg)a  Adds the necessary P4SA role bindings on the given key and bucket.

Args:
  p4sa_email: Email address of the P4SA for which to add role bindings. This
              can come from a call to GetOrCreate().
  kms_key_ref: optional, resources.Resource reference to the KMS key on which
               to add a role binding.
  bucket_ref: optional, storage_util.BucketReference to the GCS bucket on
              which to add a role binding.
zserviceAccount:{}zroles/cloudkms.signerVerifierzroles/viewerzroles/storage.objectAdminz roles/storage.legacyBucketReaderN)formatkms_iamAddPolicyBindingsToCryptoKeyr	   StorageClientAddIamPolicyBindings)
p4sa_emailkms_key_ref
bucket_ref	principalclients        r   AddResourceRoleBindingsr!   -   sz     "((4)(("AB .134 &&(F
!<=!CDFG r   )NN)__doc__
__future__r   r   r   googlecloudsdk.api_lib.cloudkmsr   r    googlecloudsdk.api_lib.privatecar   r   googlecloudsdk.api_lib.servicesr   googlecloudsdk.api_lib.storager	   r   r!    r   r   <module>r)      s*    4 &  ' : C 8 6$Gr   