
    K	                     h    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
 rg)z)Helpers for dealing with storage buckets.    )absolute_import)division)unicode_literals)storage_api)storage_util)
exceptions)logc                     [        U R                   Vs/ s HD  nUR                  R                  5       S:H  =(       a    UR                  R                  5       S:H  PMF     sn5      $ s  snf )Nallusersreader)anydefaultObjectAclentitylowerrole)bucketacls     3lib/googlecloudsdk/command_lib/privateca/storage.py_BucketAllowsPublicObjectReadsr      s_    	0020# jj J.O388>>3Cx3OO02 
3 3 2s   AA&c                    [         R                  " 5       n[        R                  " US9n UR	                  U UR
                  R                  R                  5      n[        U5      (       d  [        R                  " S5        [         R                  " U 5      $ ! [        R                   a    [        R                  " SS5      ef = f)a  Validates that a user-specified bucket can be used with a Private CA.

Args:
  bucket_name: The name of the GCS bucket to validate.

Returns:
  A BucketReference wrapping the given bucket name.

Raises:
  InvalidArgumentException: when the given bucket can't be used with a CA.
)messageszThe specified bucket does not publicly expose new objects by default, so some clients may not be able to access the CA certificate or CRLs. For more details, see https://cloud.google.com/storage/docs/access-control/making-data-publicz
gcs-bucketz The given bucket does not exist.)r   GetMessagesr   StorageClient	GetBucketStorageBucketsGetRequestProjectionValueValuesEnumfullr   r	   warningBucketReferenceBucketNotFoundErrorr   InvalidArgumentException)bucket_namer   clientr   s       r   %ValidateBucketForCertificateAuthorityr$       s     %%'($$h7&:))CCHHJF *&11	kkT ''44		(	( :

-
-8: ::s   A+B ,CN)__doc__
__future__r   r   r   googlecloudsdk.api_lib.storager   r   googlecloudsdk.callioper   googlecloudsdk.corer	   r   r$        r   <module>r,      s)    0 &  ' 6 7 . #3
 :r+   