
    K	                     h    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	 Zd
 Zy)z)Helpers for dealing with storage buckets.    )absolute_import)division)unicode_literals)storage_api)storage_util)
exceptions)logc                     t        | j                  D cg c]>  }|j                  j                         dk(  xr |j                  j                         dk(  @ c}      S c c}w )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                 |   t        j                         }t        j                  |      }	 |j	                  | |j
                  j                  j                        }t        |      st        j                  d       t        j                  |       S # t        j                  $ r t        j                  dd      w xY w)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	kkT ''44		(	( :

-
-8: ::s   A$B *B;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+   