
    "                        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	KJr  S
rSS0rSSSSSSSSSSSSSSS.rSSSSS S!S"S#S$S%S&S'S(S).r " S* S+\5      r " S, S-\5      r " S. S/\5      r " S0 S1\5      r " S2 S3\5      r " S4 S5\5      r " S6 S7\5      r " S8 S9\5      r " S: S;\5      r " S< S=\5      rS> rS? r       SCSA jr       SCSB jrg@)DaG  Utils for generating API-specific RequestConfig objects.

RequestConfig is provider neutral and should be subclassed into a
provider-specific class (e.g. GcsRequestConfig) by the factory method.

RequestConfig can hold a BucketConfig or ObjectConfig. These classes also
have provider-specific subclasses (e.g. S3ObjectConfig).
    )absolute_import)division)unicode_literals)encryption_util)errors)storage_url)log)debug_outputzapplication/octet-streamgzip_settingszGzip Transformsz(Setting Autoclass Terminal Storage ClasszSetting Default Object ACLzEnabling AutoclasszEnabling Hierarchical NamespacezSetting IP FilterzSetting Encryption EnforcementzSetting Predefined Default ACLzPublic Access Preventionz Setting Recovery Point ObjectivezSetting Retention PeriodzLocking Retention PeriodzSetting Custom ContextszRemoving Custom ContextszUpdating Custom Contexts) autoclass_terminal_storage_classdefault_object_acl_fileenable_autoclassenable_hierarchical_namespaceip_filter_file_path encryption_enforcement_file_pathpredefined_default_object_aclpublic_access_preventionrecovery_point_objectiveretention_periodretention_period_to_be_lockedcustom_contexts_to_setcustom_contexts_to_removecustom_contexts_to_updatezSetting Custom TimezSetting Default Encryption Keyz Setting Default Event Based HoldzSetting Default Storage ClasszEnabling Object RetentionzSetting Event-Based Holdsz Setting Dual-Region for a BucketzPreserving ACLszSetting Time to Retain UntilzSetting Retention ModezSetting Soft Delete PolicieszSetting Temporary Holdsz#Setting Uniform Bucket Level Access)custom_timedefault_encryption_keydefault_event_based_holddefault_storage_classenable_per_object_retentionevent_based_hold	placementpreserve_aclretain_untilretention_modesoft_delete_durationtemporary_holduniform_bucket_level_accessc                   4    \ rS rSrSr   SS jrS rS rSrg)	_ResourceConfigM   a  Holder for generic resource fields.

Attributes:
  acl_file_path (None|str): Path to file with ACL settings.
  acl_grants_to_add (None|list[dict]): Contains API representations of ACL.
    For GCS, this looks like `{ 'entity': ENTITY, 'role': GRANT }`.
  acl_grants_to_remove: (None|list[str]): Identifier of entity to remove
    access for. Can be user, group, project, or keyword like "All".
Nc                 (    Xl         X l        X0l        g)z-Initializes class, binding flag values to it.Nacl_file_pathacl_grants_to_addacl_grants_to_remove)selfr,   r-   r.   s       <lib/googlecloudsdk/api_lib/storage/request_config_factory.py__init___ResourceConfig.__init__X   s    
 '. 4    c                     [        U[        U 5      5      (       d  [        $ U R                  UR                  :H  =(       a9    U R                  UR                  :H  =(       a    U R
                  UR
                  :H  $ N)
isinstancetypeNotImplementedr,   r-   r.   r/   others     r0   __eq___ResourceConfig.__eq__a   sg    eT$Z((%"5"55 D""e&=&==D%%)C)CCEr3   c                 .    [         R                  " U 5      $ r5   r
   generic_reprr/   s    r0   __repr___ResourceConfig.__repr__h       $$T**r3   r+   )NNN	__name__
__module____qualname____firstlineno____doc__r1   r;   rA   __static_attributes__ r3   r0   r(   r(   M   s"     "!%$(5E+r3   r(   c                   Z   ^  \ rS rSrSr               SU 4S jjrU 4S jrSrU =r$ )_BucketConfigl   a  Holder for generic bucket fields.

More attributes may exist on parent class.

Attributes:
  cors_file_path (None|str): Path to file with CORS settings.
  labels_file_path (None|str): Path to file with labels settings.
  labels_to_append (None|Dict): Labels to add to a bucket.
  labels_to_remove (None|List[str]): Labels to remove from a bucket.
  lifecycle_file_path (None|str): Path to file with lifecycle settings.
  location (str|None): Location of bucket.
  log_bucket (str|None): Destination bucket for current bucket's logs.
  log_object_prefix (str|None): Prefix for objects containing logs.
  requester_pays (bool|None): If set requester pays all costs related to
    accessing the bucket and its objects.
  versioning (None|bool): Whether to turn on object versioning in a bucket.
  web_error_page (None|str): Error page address if bucket is being used
    to host a website.
  web_main_page_suffix (None|str): Suffix of main page address if bucket is
    being used to host a website.
c                    > [         [        U ]  XU5        Xl        X@l        XPl        X`l        Xpl        Xl        Xl	        Xl
        Xl        Xl        Xl        Xl        g r5   )superrM   r1   locationcors_file_pathlabels_file_pathlabels_to_appendlabels_to_removelifecycle_file_path
log_bucketlog_object_prefixrequester_pays
versioningweb_error_pageweb_main_page_suffix)r/   r,   r-   r.   rR   rS   rT   rU   rV   rQ   rW   rX   rY   rZ   r[   r\   	__class__s                   r0   r1   _BucketConfig.__init__   s^      
-'(<>M(,,,2 O.( O( 4r3   c                 r  > [        U[        U 5      5      (       d  [        $ [        [        U ]  U5      =(       Ga|    U R                  UR                  :H  =(       Ga[    U R                  UR                  :H  =(       Ga:    U R                  UR                  :H  =(       Ga    U R                  UR                  :H  =(       a    U R                  UR                  :H  =(       a    U R                  UR                  :H  =(       a    U R                  UR                  :H  =(       a    U R                  UR                  :H  =(       ay    U R                  UR                  :H  =(       aY    U R                  UR                  :H  =(       a9    U R                   UR                   :H  =(       a    U R"                  UR"                  :H  $ r5   )r6   r7   r8   rP   rM   r;   rR   rS   rT   rU   rV   rQ   rW   rX   rY   rZ   r[   r\   r/   r:   r]   s     r0   r;   _BucketConfig.__eq__   s   eT$Z((--e4 D D5#7#77D D!!U%;%;;D D !!U%;%;;D D !!U%;%;;	D
 $$(A(AAD MMU^^+D OOu///D ""e&=&==D 5#7#77D OOu///D 5#7#77D %%)C)CCEr3   )rR   rS   rT   rU   rV   rQ   rW   rX   rY   rZ   r[   r\   )NNNNNNNNNNNNNNN	rE   rF   rG   rH   rI   r1   r;   rJ   __classcell__r]   s   @r0   rM   rM   l   sH    . "!%$(" $ $ $#'!%""$(5>E Er3   rM   c                      ^  \ rS rSrSr                                  SU 4S jjrU 4S jrSrU =r$ )_GcsBucketConfig   a  Holder for GCS-specific bucket fields.

See superclass for remaining attributes.

Subclass Attributes:
  autoclass_terminal_storage_class (str|None): The storage class that
    objects in the bucket eventually transition to if they are not '
    read for a certain length of time.
  default_encryption_key (str|None): A key used to encrypt objects
    added to the bucket.
  default_event_based_hold (bool|None): Determines if event-based holds will
    automatically be applied to new objects in bucket.
  default_object_acl_file_path (str|None): File path to default object ACL
    file.
  default_object_acl_grants_to_add (list[dict]|None): Add default object ACL
    grants to an entity for objects in the bucket.
  default_object_acl_grants_to_remove (list[str]|None): Remove default object
    ACL grants.
  default_storage_class (str|None): Storage class assigned to objects in the
    bucket by default.
  enable_autoclass (bool|None): Enable, disable, or don't do anything to the
    autoclass feature. Autoclass automatically changes object storage class
    based on usage.
  enable_per_object_retention (bool|None): Enable the object retention for the
    bucket.
  enable_hierarchical_namespace (bool|None): Enable heirarchical namespace
  during bucket creation.
  placement (list|None): Dual-region of bucket.
  public_access_prevention (bool|None): Blocks public access to bucket.
    See docs for specifics:
    https://cloud.google.com/storage/docs/public-access-prevention
  recovery_point_objective (str|None): Specifies the replication setting for
    dual-region and multi-region buckets.
  retention_period (int|None): Minimum retention period in seconds for objects
    in a bucket. Attempts to delete an object earlier will be denied.
  soft_delete_duration (int|None): Number of seconds objects are preserved and
    restorable after deletion in a bucket with soft delete enabled.
  uniform_bucket_level_access (bool|None):
    Determines if the IAM policies will apply to every object in bucket.
c#                 L  > [         [        U ]  UUUUUUUUUUUUU U!U"5        X@l        X`l        Xpl        Xl        Xl        Xl        UU l	        Xl
        Xl        Xl        Xl        UU l        UU l        UU l        UU l        UU l        UU l        UU l        UU l        UU l        g r5   )rP   rf   r1   r   r   r   r   default_object_acl_file_path default_object_acl_grants_to_add#default_object_acl_grants_to_remover   r   r   r   r   r    r   r   rY   r   r   r$   r&   )$r/   r,   r-   r.   r   rR   r   r   r   ri   rj   rk   r   r   r   r   r   rS   rT   rU   rV   rQ   rW   rX   r    r   r   rY   r   r   r$   r&   rZ   r[   r\   r]   s$                                      r0   r1   _GcsBucketConfig.__init__   s    J 

D*" -M)"8,L)$<!(D%,L)+ 	, "7,'B$)F&2DDN$<D!$<D!(D,D)FD& 4D'BD$r3   c                 @  > [        U[        U 5      5      (       d  [        $ [        [        U ]  U5      =(       Gac    U R                  UR                  :H  =(       GaB    U R                  UR                  :H  =(       Ga!    U R                  UR                  :H  =(       Ga     U R                  UR                  :H  =(       Ga    U R                  UR                  :H  =(       Ga    U R                  UR                  :H  =(       Ga    U R                  UR                  :H  =(       Ga|    U R                  UR                  :H  =(       Ga[    U R                  UR                  :H  =(       Ga:    U R                  UR                  :H  =(       Ga    U R                   UR                   :H  =(       a    U R"                  UR"                  :H  =(       a    U R$                  UR$                  :H  =(       a    U R&                  UR&                  :H  =(       a    U R(                  UR(                  :H  =(       ay    U R*                  UR*                  :H  =(       aY    U R,                  UR,                  :H  =(       a9    U R.                  UR.                  :H  =(       a    U R0                  UR0                  :H  $ r5   )r6   r7   r8   rP   rf   r;   r   r   r   r   rj   rk   r   r   r   r   r   r    r   r   rY   r   r   r$   r&   r`   s     r0   r;   _GcsBucketConfig.__eq__+  sy   eT$Z((,U3 	- 	-11112	- 	- ''5+G+GG	- 	- 11112		- 	- ))U-K-KK	- 	- 11112	- 	- 44445	- 	- &&%*E*EE	- 	- !!U%;%;;	- 	- ,,,,-	- 	- ..../	- 	-" $$(A(AA#	-$ NNeoo-%	-& ))U-K-KK'	-( ))U-K-KK)	-* 5#7#77+	-, !!U%;%;;-	-. ....//	-2 %%)C)CC3	-4 ,,,,-7r3   )r   r   r   ri   rj   rk   r   r   r   r   r   r   r    r   r   rY   r   r   r$   r&   )"NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNrb   rd   s   @r0   rf   rf      s    'V '+!'+##''+*. "&$(##$("&GKCZ   r3   rf   c                       \ rS rSrSrSrg)_S3BucketConfigiN  zHolder for S3-specific bucket fields.

See superclass for attributes.
We currently don't support any S3-only fields. This class exists to maintain
the provider-specific subclass pattern used by the request config factory.
rK   NrE   rF   rG   rH   rI   rJ   rK   r3   r0   rp   rp   N  s    r3   rp   c                   d   ^  \ rS rSrSr                    SU 4S jjrU 4S jrSrU =r$ )_ObjectConfigiW  a  Holder for storage object settings shared between cloud providers.

Superclass and provider-specific subclasses may add more attributes.

Attributes:
  cache_control (str|None): Influences how backend caches requests and
    responses.
  content_disposition (str|None): Information on how content should be
    displayed.
  content_encoding (str|None): How content is encoded (e.g. "gzip").
  content_language (str|None): Content's language (e.g. "en" = "English).
  content_type (str|None): Type of data contained in content (e.g.
    "text/html").
  custom_contexts_to_set (dict|None): Custom contexts fields set by user.
  custom_contexts_to_remove (dict|None): Custom contexts fields to be removed
    by user.
  custom_contexts_to_update (dict|None): Custom contexts field to be added or
    changed by user.
  custom_fields_to_set (dict|None): Custom metadata fields set by user.
  custom_fields_to_remove (dict|None): Custom metadata fields to be removed.
  custom_fields_to_update (dict|None): Custom metadata fields to be added or
    changed.
  decryption_key (encryption_util.EncryptionKey): The key that should be used
    to decrypt information in GCS.
  encryption_key (encryption_util.EncryptionKey|None|CLEAR): The key that
    should be used to encrypt information in GCS or clear encryptions (the
    string user_request_args_factory.CLEAR).
  md5_hash (str|None): MD5 digest to use for validation.
  preserve_acl (bool): Whether or not to preserve existing ACLs on an object
    during a copy or other operation.
  size (int|None): Object size in bytes.
  storage_class (str|None): Storage class for cloud object. If None, will use
    bucket's default.
c                   > [         [        U ]  XU5        X@l        XPl        X`l        Xpl        Xl        Xl        Xl	        Xl
        Xl        Xl        Xl        Xl        UU l        UU l        UU l        UU l        UU l        g r5   )rP   rs   r1   cache_controlcontent_dispositioncontent_encodingcontent_languagecontent_typer   r   r   custom_fields_to_setcustom_fields_to_removecustom_fields_to_updatedecryption_keyencryption_keymd5_hashr!   sizestorage_class)r/   r,   r-   r.   ru   rv   rw   rx   ry   r   r   r   rz   r{   r|   r}   r~   r   r!   r   r   r]   s                        r0   r1   _ObjectConfig.__init__{  s    . 
-'*> '2,,$"8%>"%>" 4#: #: ((DDM$DDI&Dr3   c                   > [        U[        U 5      5      (       d  [        $ [        [        U ]  U5      =(       Ga!    U R                  UR                  :H  =(       Ga     U R                  UR                  :H  =(       Ga    U R                  UR                  :H  =(       Ga    U R                  UR                  :H  =(       Ga    U R                  UR                  :H  =(       Ga|    U R                  UR                  :H  =(       Ga[    U R                  UR                  :H  =(       Ga:    U R                  UR                  :H  =(       Ga    U R                  UR                  :H  =(       a    U R                  UR                  :H  =(       a    U R                   UR                   :H  =(       a    U R"                  UR"                  :H  =(       a    U R$                  UR$                  :H  =(       ay    U R&                  UR&                  :H  =(       aY    U R(                  UR(                  :H  =(       a9    U R*                  UR*                  :H  =(       a    U R,                  UR,                  :H  $ r5   )r6   r7   r8   rP   rs   r;   ru   rv   rw   rx   ry   r   r   r   rz   r{   r|   r}   r~   r   r   r!   r   r`   s     r0   r;   _ObjectConfig.__eq__  s   eT$Z((mT)%0 	6 	6%"5"55	6 	6$$(A(AA	6 	6 !!U%;%;;	6 	6 !!U%;%;;		6 	6
 !3!33	6 	6 ''5+G+GG	6 	6 **e.M.MM	6 	6 **e.M.MM	6 	6 %%)C)CC	6 ((E,I,II	6 ((E,I,II	6 5#7#77	6 5#7#77	6 MMU^^+	6 II#	6  !3!33!	6" %"5"55%r3   )ru   rv   rw   rx   ry   r   r   r   r{   rz   r|   r}   r~   r   r!   r   r   )NNNNNNNNNNNNNNNNNNNNrb   rd   s   @r0   rs   rs   W  sW    !J ! $ $""+*'X r3   rs   c                   j   ^  \ rS rSrSr                       SU 4S jjrU 4S jrSrU =r$ )_GcsObjectConfigi  aQ  Arguments object for requests with custom GCS parameters.

See superclass for additional attributes.

Attributes:
  event_based_hold (bool|None): An event-based hold should be placed on an
    object.
  custom_time (datetime|None): Custom time user can set.
  retain_until (datetime|None): Time to retain the object until.
  retention_mode (flags.RetentionMode|None|CLEAR): The key that should
    be used to set the retention mode policy in GCS or clear retention (the
    string user_request_args_factory.CLEAR).
  temporary_hold (bool|None): A temporary hold should be placed on an object.
c                    > [         [        U ]  UUUUUUUUU	U
UUUUUUUUS9  Xl        UU l        UU l        UU l        UU l        g )N)r,   r-   r.   ru   rv   rw   rx   ry   r   r   r   rz   r{   r|   r}   r~   r   r   )rP   r   r1   r   r   r"   r#   r%   )r/   r,   r-   r.   ru   rv   rw   rx   ry   r   r   r   rz   r{   r|   r   r}   r~   r   r   r"   r#   r   r%   r]   s                           r0   r1   _GcsObjectConfig.__init__  sx    4 

D*#+1#/))!5";";1 7 7%%% + & #,D$D(D(Dr3   c                   > [        U[        U 5      5      (       d  [        $ [        [        U ]  U5      =(       a    U R                  UR                  :H  =(       ay    U R                  UR                  :H  =(       aY    U R                  UR                  :H  =(       a9    U R                  UR                  :H  =(       a    U R                  UR                  :H  $ r5   )r6   r7   r8   rP   r   r;   r   r   r"   r#   r%   r`   s     r0   r;   _GcsObjectConfig.__eq__  s    eT$Z(("D07 8 1 118!!U%;%;;8 !3!338 5#7#77	8
 5#7#779r3   )r   r   r"   r#   r%   )NNNNNNNNNNNNNNNNNNNNNNNrb   rd   s   @r0   r   r     s_    $ ! $ $""11)f9 9r3   r   c                       \ rS rSrSrSrg)_S3ObjectConfigi  zBWe currently do not support any S3-specific object configurations.rK   Nrq   rK   r3   r0   r   r     s    Jr3   r   c                   8    \ rS rSrSr     SS jrS rS rSrg)	_RequestConfigi  a$  Holder for parameters shared between cloud providers.

Provider-specific subclasses may add more attributes.

Attributes:
  predefined_acl_string (str|None): ACL to set on resource.
  predefined_default_object_acl_string (str|None): Default ACL to set on
    resources.
  preserve_posix (bool|None): Whether to apply source POSIX metadata to
    destination.
  preserve_symlinks (bool|None): Whether symlinks should be preserved rather
    than followed.
  resource_args (_BucketConfig|_ObjectConfig|None): Holds settings for a cloud
    resource.
Nc                 B    Xl         UU l        X0l        X@l        XPl        g r5   predefined_acl_string$predefined_default_object_acl_stringpreserve_posixpreserve_symlinksresource_args)r/   r   r   r   r   r   s         r0   r1   _RequestConfig.__init__$  s)     "7, 	- ).&r3   c                 t   [        U[        U 5      5      (       d  [        $ U R                  UR                  :H  =(       ay    U R                  UR                  :H  =(       aY    U R
                  UR
                  :H  =(       a9    U R                  UR                  :H  =(       a    U R                  UR                  :H  $ r5   )r6   r7   r8   r   r   r   r   r   r9   s     r0   r;   _RequestConfig.__eq__4  s    eT$Z((""e&A&AA 	655556	6 5#7#77	6 ""e&=&==		6
 %"5"55r3   c                 .    [         R                  " U 5      $ r5   r>   r@   s    r0   rA   _RequestConfig.__repr__@  rC   r3   r   )NNNNNrD   rK   r3   r0   r   r     s'    $ !+/' 
+r3   r   c                   L   ^  \ rS rSrSr        SU 4S jjrU 4S jrSrU =r$ )_GcsRequestConfigiE  a  Holder for GCS-specific API request parameters.

See superclass for additional attributes.

Attributes:
  gzip_settings (user_request_args_factory.GzipSettings): Contains settings
    for gzipping uploaded files.
  no_clobber (bool): Do not copy if destination resource already exists.
  override_unlocked_retention (bool|None): Needed as confirmation for some
    changes to object retention policies.
  precondition_generation_match (int|None): Perform request only if generation
    of target object matches the given integer. Ignored for bucket requests.
  precondition_metageneration_match (int|None): Perform request only if
    metageneration of target object/bucket matches the given integer.
c	                 h   > [         [        U ]  UUUS9  Xl        X l        X0l        X@l        XPl        g )N)r   r   r   )rP   r   r1   r   
no_clobberoverride_unlocked_retentionprecondition_generation_match!precondition_metageneration_match)
r/   r   r   r   r   r   r   r   r   r]   s
            r0   r1   _GcsRequestConfig.__init__W  sB     

T+30#	 , %
 ' O'B$)F&-N*r3   c                   > [        U[        U 5      5      (       d  [        $ [        [        U ]  U5      =(       a    U R                  UR                  :H  =(       ay    U R                  UR                  :H  =(       aY    U R                  UR                  :H  =(       a9    U R                  UR                  :H  =(       a    U R                  UR                  :H  $ r5   )r6   r7   r8   rP   r   r;   r   r   r   r   r   r`   s     r0   r;   _GcsRequestConfig.__eq__m  s    eT$Z((-e4 	3%"5"55	3OOu///	3 ,,,,-	3
 ..../	3 22223
r3   )r   r   r   r   r   )NNNNNNNNrb   rd   s   @r0   r   r   E  s2    & "&$((, +/O, r3   r   c                       \ rS rSrSrSrg)_S3RequestConfigi}  zHolder for S3-specific API request parameters.

Currently just meant for use with S3ObjectConfig and S3BucketConfig in
the parent class "resource_args" field.
rK   Nrq   rK   r3   r0   r   r   }  s    r3   r   c                 r    / nU H%  n[        XS5      c  M  UR                  X   5        M'     [        U5      $ )z@Takes user_args and unsupported_fields and returns feature list.N)getattrappendsorted)	user_argsunsupported_fieldsresultfields       r0   ,_extract_unsupported_features_from_user_argsr     s:    &!ey&2mm&-. " 
r3   c                    [        U SS5      nU(       a  [        USS5      (       d  SUl        [        U [        5      [        U[        5      -   nU(       a4  [
        R                  " SR                  SR                  U5      5      5      e[        U[        5      nU(       a5  [        R                  " SR                  SR                  U5      5      5        gg)z=Raises error or logs warning if unsupported S3 field present.r   Nr   zFeatures disallowed for S3: {}z, z(Some features do not have S3 support: {})r   r   r   S3_REQUEST_ERROR_FIELDSS3_RESOURCE_ERROR_FIELDSr   ErrorformatjoinS3_RESOURCE_WARNING_FIELDSr	   warning)user_request_argsuser_resource_argserror_fields_presentwarning_fields_presents       r0    _check_for_unsupported_s3_fieldsr     s    0/4H94!A !A7;423D3JL23E3KMM 
 
,,(//		:N0OP  H46KK:AA		()+ , r3   Nc                    [        U [        R                  5      (       d  g[        USS5      nSn	U R	                  5       (       Ga  U R
                  [        R                  ;   Ga  U R
                  [        R                  R                  :X  GaV  [        5       n	U(       GaC  UR                  U	l
        UR                  U	l        UR                  U	l        UR                  U	l        UR                  U	l        UR                  U	l        UR                   U	l        UR"                  U	l        UR$                  U	l        UR&                  U	l        UR(                  U	l        UR*                  U	l        UR,                  U	l        UR.                  U	l        UR0                  U	l        UR2                  U	l        UR4                  U	l        UR6                  U	l        UR8                  U	l        OHU R
                  [        R                  R:                  :X  a  [=        5       n	[?        U5        O
[A        5       n	[        USS5      U	l!        [        USS5      U	l"        [        USS5      U	l#        [        USS5      U	l$        [        USS5      U	l%        [        USS5      U	l&        [        US	S5      U	l'        [        US
S5      U	l(        [        USS5      U	l)        [        USS5      U	l*        [        USS5      U	l+        [        USS5      U	l,        GOU R[                  5       (       Ga  U R
                  [        R                  R                  :X  ag  []        5       n	U(       aU  UR^                  U	l/        UR`                  U	l0        URb                  U	l1        URd                  U	l2        URf                  U	l3        OHU R
                  [        R                  R:                  :X  a  [i        5       n	[?        U5        O
[k        5       n	Xl6        XYl7        Xil8        U=(       d    [r        Rt                  " 5       U	l;        U(       a$  [r        Rx                  " X$(       a  U OS5      U	l=        U(       GaD  URl                  b.  URl                  (       a  URl                  U	l6        O[|        U	l6        URn                  b  URn                  U	l7        UR~                  U	l?        UR                  U	l@        UR                  U	lA        UR                  U	lB        UR                  U	lC        UR                  U	lD        UR                  U	lE        UR                  U	lF        UR                  U	lG        UR                  U	lH        UR                  U	lI        UR                  (       a  UR                  R                  5       U	lJ        U	(       a:  U(       a3  UR                  U	lL        UR                  U	lM        UR                  U	lN        U	$ )z@Generates metadata for API calls to storage buckets and objects.Nr   rQ   rR   rS   rT   rU   rV   rW   rX   rY   rZ   r[   r\   )Or6   r   CloudUrlr   	is_bucketschemeVALID_CLOUD_SCHEMESProviderPrefixGCSrf   r   r   r   r   ri   rj   rk   r   r   r   r   r   r    r   r   r   r   r$   r&   S3rp   r   rM   rQ   rR   rS   rT   rU   rV   rW   rX   rY   rZ   r[   r\   	is_objectr   r   r   r"   r#   r%   r   rs   ry   r   r   r   get_encryption_keyr~   get_decryption_keyr}   DEFAULT_CONTENT_TYPEru   rv   rw   rx   rz   r{   r|   r   r   r   r!   r   upperr,   r-   r.   )
urlry   decryption_key_hash_sha256r~   error_on_missing_keyr   r   r   r   new_resource_argss
             r0   !_get_request_config_resource_argsr     s    
C--	.	.0/4H]]__
zz[444	{1155	5,. AA 
< !77 
2 !AA 
< !99 
4 !== 
8 !AA 
< !DD 
? !66 
1 !11 
, !<< 
7 !>> 
9 !44 
/ );(D(D

% 99 
4 !99 
4 !11 
, !>> 
9 !55 
0 !<< 
7 ::33666+-():; (/!();Z!N'.,d(4$)0.*6&)0.*6&)0.*6&,314-9)#*L$$0 *1/+7''./A/?(G$#*L$$0 '.,d(4$-42D.:* }}
zz[//333*,	(:(F(F%-?-P-P*);)H)H&+=+L+L(+=+L+L(	{1144	4)+&'89 (/%1"!)! 	>/<<> $!)8)K)K
$-Act*M& 		(	(	4**+=+J+J

(+?

(		$	$	0%7%@%@"(:(H(H%

0
0 + ,>+N+N(+=+N+N(

1
1 , 
4
4 / 
4
4 / 
3
3 . 
6
6 1 
6
6 1 (:'F'F$		)	) ,,224 	' -&8&F&F#*<*N*N'// * 
r3   c           
         [        XX#XEXg5      nU R                  [        R                  R                  :X  a  [        US9n	U(       a  UR                  U	l        UR                  U	l        UR                  (       a  UR                  U	l        UR                  (       a  [        UR                  5      U	l	        UR                  (       a  [        UR                  5      U	l        O;U R                  [        R                  R                  :X  a
  [        US9n	O	[        US9n	[        USS5      U	l        [        USS5      U	l        [        USS5      U	l        [        USS5      U	l        U(       a  UR(                  U	l        U	$ SU	l        U	$ )zFGenerates API-specific RequestConfig. See output classes for arg info.)r   ri   Nr   r   r   )r   r   r   r   r   r   r   r   r   r   intr   r   r   r   r   ri   r   r   r   r   )
r   ry   r   r~   r   r   r   r   r   request_configs
             r0   get_request_configr   T  so    4	3d?- 	ZZ;--111&]CN%6%D%Dn"

7
7 0 
	%	%$5$@$@!		8	87:;;8=4		<	<;>??<A8
zz[//222%MBN#-@N0771?.-)01B1H$*P.&8??9G.5"))4#. .?)) " 
 EI " 
r3   )NNNTNNN) rI   
__future__r   r   r   "googlecloudsdk.command_lib.storager   r   r   googlecloudsdk.corer	   googlecloudsdk.core.utilr
   r   r   r   r   objectr(   rM   rf   rp   rs   r   r   r   r   r   r   r   r   r   rK   r3   r0   <module>r      so   '  ' > 5 : # 1 2 
 & 
 	3;,%F.(H%E : B2%?7!;!;! & )> B<#>33%2.:/#H "+f +>EEO EEPW} Wtm fO fRL9} L9^Km K.+V .+d5 5p~ ,2 48AE59;?/3+/8<k` #	/r3   