
    (phq                       S r SSKrSSKrSSKrSSKrSSKJr  SSK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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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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'J0r0  SS"K'J1r1  SS#K'J2r2  SS$K'J3r3  SS%K4J5r5  SS&K4J6r6  SS'K7J8r8  SS(K7J9r9  SS)K7J:r:  SS*K7J;r;  S+r<S,r=S-r>S.r?S/r@S0rAS1 rBS2 rCS3 rD " S4 S5\E5      rF " S6 S7\E5      rG " S8 S9\E5      rH " S: S;\E5      rI\J" 5       rK " S< S=\E5      rL " S> S?\5      rM " S@ SA\E5      rNSB rOg)Cz4Create / interact with Google Cloud Storage buckets.    N)urlsplit)datetime_helpers)_datetime_to_rfc3339)_rfc3339_nanos_to_datetime)NotFound)Policy)_signing)_add_etag_match_headers) _add_generation_match_parameters)_NOW)_PropertyMixin)_UTC)_scalar_property)_validate_name)generate_signed_url_v2)generate_signed_url_v4)_bucket_bound_hostname_url)_virtual_hosted_style_base_url)create_trace_span)	BucketACL)DefaultObjectACLBlob)_DEFAULT_TIMEOUT)ARCHIVE_STORAGE_CLASS)COLDLINE_STORAGE_CLASS)DUAL_REGION_LOCATION_TYPE)1DURABLE_REDUCED_AVAILABILITY_LEGACY_STORAGE_CLASS)#MULTI_REGIONAL_LEGACY_STORAGE_CLASS)MULTI_REGION_LOCATION_TYPE)NEARLINE_STORAGE_CLASS)"PUBLIC_ACCESS_PREVENTION_INHERITED)REGIONAL_LEGACY_STORAGE_CLASS)REGION_LOCATION_TYPE)STANDARD_STORAGE_CLASSBucketNotification)NONE_PAYLOAD_FORMAT)DEFAULT_RETRY)%DEFAULT_RETRY_IF_GENERATION_SPECIFIED)DEFAULT_RETRY_IF_ETAG_IN_JSON))DEFAULT_RETRY_IF_METAGENERATION_SPECIFIEDzlPass only one of 'uniform_bucket_level_access_enabled' / 'bucket_policy_only_enabled' to 'IAMConfiguration'.z'IAMConfiguration.bucket_policy_only_enabled' is deprecated.  Instead, use 'IAMConfiguration.uniform_bucket_level_access_enabled'.zpPass only one of 'uniform_bucket_level_access_lock_time' / 'bucket_policy_only_lock_time' to 'IAMConfiguration'.z'IAMConfiguration.bucket_policy_only_lock_time' is deprecated.  Instead, use 'IAMConfiguration.uniform_bucket_level_access_lock_time'.zAssignment to 'Bucket.location' is deprecated, as it is only valid before the bucket is created. Instead, pass the location to `Bucket.create`.zBBucket.from_string() is deprecated. Use Bucket.from_uri() instead.c                     [        UR                  SS5      5      Ul        U R                  R                  UR                  5        g)a}  Grab prefixes after a :class:`~google.cloud.iterator.Page` started.

:type iterator: :class:`~google.api_core.page_iterator.Iterator`
:param iterator: The iterator that is currently in use.

:type page: :class:`~google.cloud.api.core.page_iterator.Page`
:param page: The page that was just created.

:type response: dict
:param response: The JSON API response for a page of blobs.
prefixes N)tuplegetr.   update)iteratorpageresponses      N/var/www/html/venv/lib/python3.13/site-packages/google/cloud/storage/bucket.py_blobs_page_startr7   ]   s3     (,,z267DMT]]+    c                 p    UR                  S5      n[        X R                  S9nUR                  U5        U$ )a  Convert a JSON blob to the native object.

.. note::

    This assumes that the ``bucket`` attribute has been
    added to the iterator after being created.

:type iterator: :class:`~google.api_core.page_iterator.Iterator`
:param iterator: The iterator that has retrieved the item.

:type item: dict
:param item: An item to be converted to a blob.

:rtype: :class:`.Blob`
:returns: The next blob in the page.
namebucket)r1   r   r<   _set_properties)r3   itemr:   blobs       r6   _item_to_blobr@   m   s3    " 88FD__-DKr8   c                 >    [         R                  " XR                  S9$ )a  Convert a JSON blob to the native object.

.. note::

    This assumes that the ``bucket`` attribute has been
    added to the iterator after being created.

:type iterator: :class:`~google.api_core.page_iterator.Iterator`
:param iterator: The iterator that has retrieved the item.

:type item: dict
:param item: An item to be converted to a blob.

:rtype: :class:`.BucketNotification`
:returns: The next notification being iterated.
r;   )r'   from_api_reprr<   )r3   r>   s     r6   _item_to_notificationrC      s    " ++DIIr8   c                     ^  \ rS rSrSr            SU 4S jjr\S 5       r\S 5       r	\S 5       r
\S 5       r\S 5       r\S	 5       r\S
 5       r\S 5       r\S 5       r\S 5       r\S 5       r\S 5       rSrU =r$ )LifecycleRuleConditions   a  Map a single lifecycle rule for a bucket.

See: https://cloud.google.com/storage/docs/lifecycle

:type age: int
:param age: (Optional) Apply rule action to items whose age, in days,
            exceeds this value.

:type created_before: datetime.date
:param created_before: (Optional) Apply rule action to items created
                       before this date.

:type is_live: bool
:param is_live: (Optional) If true, apply rule action to non-versioned
                items, or to items with no newer versions. If false, apply
                rule action to versioned items with at least one newer
                version.

:type matches_prefix: list(str)
:param matches_prefix: (Optional) Apply rule action to items which
                              any prefix matches the beginning of the item name.

:type matches_storage_class: list(str), one or more of
                             :attr:`Bucket.STORAGE_CLASSES`.
:param matches_storage_class: (Optional) Apply rule action to items
                              whose storage class matches this value.

:type matches_suffix: list(str)
:param matches_suffix: (Optional) Apply rule action to items which
                              any suffix matches the end of the item name.

:type number_of_newer_versions: int
:param number_of_newer_versions: (Optional) Apply rule action to versioned
                                 items having N newer versions.

:type days_since_custom_time: int
:param days_since_custom_time: (Optional) Apply rule action to items whose number of days
                               elapsed since the custom timestamp. This condition is relevant
                               only for versioned objects. The value of the field must be a non
                               negative integer. If it's zero, the object version will become
                               eligible for lifecycle action as soon as it becomes custom.

:type custom_time_before: :class:`datetime.date`
:param custom_time_before: (Optional)  Date object parsed from RFC3339 valid date, apply rule action
                           to items whose custom time is before this date. This condition is relevant
                           only for versioned objects, e.g., 2019-03-16.

:type days_since_noncurrent_time: int
:param days_since_noncurrent_time: (Optional) Apply rule action to items whose number of days
                                    elapsed since the non current timestamp. This condition
                                    is relevant only for versioned objects. The value of the field
                                    must be a non negative integer. If it's zero, the object version
                                    will become eligible for lifecycle action as soon as it becomes
                                    non current.

:type noncurrent_time_before: :class:`datetime.date`
:param noncurrent_time_before: (Optional) Date object parsed from RFC3339 valid date, apply
                               rule action to items whose non current time is before this date.
                               This condition is relevant only for versioned objects, e.g, 2019-03-16.

:raises ValueError: if no arguments are passed.
c                 V  > 0 nUb  XS'   Ub  UR                  5       US'   Ub  X=S'   Ub  XMS'   Ub  X]S'   Ub  XmS'   Ub  UR                  5       US'   Ub  XS'   U	b  U	R                  5       US	'   U
b  XS
'   Ub  XS'   U(       d  U(       d  [        S5      e[        [        U ]  U5        g )NagecreatedBeforeisLivematchesStorageClassnumNewerVersionsdaysSinceCustomTimecustomTimeBeforedaysSinceNoncurrentTimenoncurrentTimeBeforematchesPrefixmatchesSuffixzSupply at least one condition)	isoformat
ValueErrorsuperrE   __init__)selfrH   created_beforeis_livematches_storage_classnumber_of_newer_versionsdays_since_custom_timecustom_time_beforedays_since_noncurrent_timenoncurrent_time_beforematches_prefixmatches_suffix_factory
conditions	__class__s                 r6   rV    LifecycleRuleConditions.__init__   s     
? #u%*8*B*B*DJ'#*x  ,0E,-#/-E)*!-0F,-)-?-I-I-KJ)*%14N01!-1G1Q1Q1SJ-.%*8'%*8'
<==%t5jAr8   c                 4    U " SS9nUR                  U5        U$ )zFactory:  construct instance from resource.

:type resource: dict
:param resource: mapping as returned from API call.

:rtype: :class:`LifecycleRuleConditions`
:returns: Instance created from resource.
Trb   r2   clsresourceinstances      r6   rB   %LifecycleRuleConditions.from_api_repr       %!r8   c                 $    U R                  S5      $ )zConditon's age value.rH   r1   rW   s    r6   rH   LifecycleRuleConditions.age  s     xxr8   c                 X    U R                  S5      nUb  [        R                  " U5      $ g)z Conditon's created_before value.rI   Nr1   r   from_iso8601_daterW   befores     r6   rX   &LifecycleRuleConditions.created_before"  s.     /*#55f== r8   c                 $    U R                  S5      $ )zConditon's 'is_live' value.rJ   rp   rq   s    r6   rY   LifecycleRuleConditions.is_live)  s     xx!!r8   c                 $    U R                  S5      $ )z"Conditon's 'matches_prefix' value.rQ   rp   rq   s    r6   r`   &LifecycleRuleConditions.matches_prefix.       xx((r8   c                 $    U R                  S5      $ )z)Conditon's 'matches_storage_class' value.rK   rp   rq   s    r6   rZ   -LifecycleRuleConditions.matches_storage_class3       xx-..r8   c                 $    U R                  S5      $ )z"Conditon's 'matches_suffix' value.rR   rp   rq   s    r6   ra   &LifecycleRuleConditions.matches_suffix8  r}   r8   c                 $    U R                  S5      $ )z,Conditon's 'number_of_newer_versions' value.rL   rp   rq   s    r6   r[   0LifecycleRuleConditions.number_of_newer_versions=  s     xx*++r8   c                 $    U R                  S5      $ )z*Conditon's 'days_since_custom_time' value.rM   rp   rq   s    r6   r\   .LifecycleRuleConditions.days_since_custom_timeB  r   r8   c                 X    U R                  S5      nUb  [        R                  " U5      $ g)z&Conditon's 'custom_time_before' value.rN   Nrt   rv   s     r6   r]   *LifecycleRuleConditions.custom_time_beforeG  s/     ,-#55f== r8   c                 $    U R                  S5      $ )z.Conditon's 'days_since_noncurrent_time' value.rO   rp   rq   s    r6   r^   2LifecycleRuleConditions.days_since_noncurrent_timeN  s     xx122r8   c                 X    U R                  S5      nUb  [        R                  " U5      $ g)z*Conditon's 'noncurrent_time_before' value.rP   Nrt   rv   s     r6   r_   .LifecycleRuleConditions.noncurrent_time_beforeS  s/     01#55f== r8   r/   )NNNNNNNNNNNF)__name__
__module____qualname____firstlineno____doc__rV   classmethodrB   propertyrH   rX   rY   r`   rZ   ra   r[   r\   r]   r^   r_   __static_attributes____classcell__rd   s   @r6   rE   rE      s&   =B "!%##'#5Bn     > > " " ) ) / / ) ) , , / / > > 3 3 > >r8   rE   c                   <   ^  \ rS rSrSrU 4S jr\S 5       rSrU =r	$ )LifecycleRuleDeletei[  zMap a lifecycle rule deleting matching items.

:type kw: dict
:params kw: arguments passed to :class:`LifecycleRuleConditions`.
c                 Z   > [        S0 UD6nSS0[        U5      S.n[        TU ]  U5        g )NtypeDeleteaction	conditionr/   rE   dictrU   rV   rW   kwrc   rulerd   s       r6   rV   LifecycleRuleDelete.__init__b  s1    ,2r2
!8,4
;KLr8   c                 4    U " SS9nUR                  U5        U$ )zFactory:  construct instance from resource.

:type resource: dict
:param resource: mapping as returned from API call.

:rtype: :class:`LifecycleRuleDelete`
:returns: Instance created from resource.
Trg   rh   ri   s      r6   rB   !LifecycleRuleDelete.from_api_reprg  rn   r8   r/   
r   r   r   r   r   rV   r   rB   r   r   r   s   @r6   r   r   [  s!    
  r8   r   c                   <   ^  \ rS rSrSrU 4S jr\S 5       rSrU =r	$ )LifecycleRuleSetStorageClassiv  a  Map a lifecycle rule updating storage class of matching items.

:type storage_class: str, one of :attr:`Bucket.STORAGE_CLASSES`.
:param storage_class: new storage class to assign to matching items.

:type kw: dict
:params kw: arguments passed to :class:`LifecycleRuleConditions`.
c                 \   > [        S0 UD6nSUS.[        U5      S.n[        TU ]  U5        g )NSetStorageClass)r   storageClassr   r/   r   )rW   storage_classr   rc   r   rd   s        r6   rV   %LifecycleRuleSetStorageClass.__init__  s6    ,2r2
0-Pj)
 	r8   c                 F    US   nU " US   SS9nUR                  U5        U$ )zFactory:  construct instance from resource.

:type resource: dict
:param resource: mapping as returned from API call.

:rtype: :class:`LifecycleRuleSetStorageClass`
:returns: Instance created from resource.
r   r   Trg   rh   )rj   rk   r   rl   s       r6   rB   *LifecycleRuleSetStorageClass.from_api_repr  s0     (#vn-=!r8   r/   r   r   s   @r6   r   r   v  s!      r8   r   c                   <   ^  \ rS rSrSrU 4S jr\S 5       rSrU =r	$ )+LifecycleRuleAbortIncompleteMultipartUploadi  zMap a rule aborting incomplete multipart uploads of matching items.

The "age" lifecycle condition is the only supported condition for this rule.

:type kw: dict
:params kw: arguments passed to :class:`LifecycleRuleConditions`.
c                 Z   > [        S0 UD6nSS0[        U5      S.n[        TU ]  U5        g )Nr   AbortIncompleteMultipartUploadr   r/   r   r   s       r6   rV   4LifecycleRuleAbortIncompleteMultipartUpload.__init__  s7    ,2r2
?@j)
 	r8   c                 4    U " SS9nUR                  U5        U$ )zFactory:  construct instance from resource.

:type resource: dict
:param resource: mapping as returned from API call.

:rtype: :class:`LifecycleRuleAbortIncompleteMultipartUpload`
:returns: Instance created from resource.
Trg   rh   ri   s      r6   rB   9LifecycleRuleAbortIncompleteMultipartUpload.from_api_repr  rn   r8   r/   r   r   s   @r6   r   r     s!      r8   r   c                     ^  \ rS rSrSr\\\\\4U 4S jjr\S 5       r\	S 5       r
\	S 5       r\R                  S 5       r\	S 5       r\R                  S	 5       r\	S
 5       r\	S 5       r\R                  S 5       r\	S 5       rSrU =r$ )IAMConfigurationi  aD  Map a bucket's IAM configuration.

:type bucket: :class:`Bucket`
:params bucket: Bucket for which this instance is the policy.

:type public_access_prevention: str
:params public_access_prevention:
    (Optional) Whether the public access prevention policy is 'inherited' (default) or 'enforced'
    See: https://cloud.google.com/storage/docs/public-access-prevention

:type uniform_bucket_level_access_enabled: bool
:params bucket_policy_only_enabled:
    (Optional) Whether the IAM-only policy is enabled for the bucket.

:type uniform_bucket_level_access_locked_time: :class:`datetime.datetime`
:params uniform_bucket_level_locked_time:
    (Optional) When the bucket's IAM-only policy was enabled.
    This value should normally only be set by the back-end API.

:type bucket_policy_only_enabled: bool
:params bucket_policy_only_enabled:
    Deprecated alias for :data:`uniform_bucket_level_access_enabled`.

:type bucket_policy_only_locked_time: :class:`datetime.datetime`
:params bucket_policy_only_locked_time:
    Deprecated alias for :data:`uniform_bucket_level_access_locked_time`.
c                   > U[         La8  U[         La  [        [        5      e[        R                  " [
        [        SS9  UnU[         La8  U[         La  [        [        5      e[        R                  " [        [        SS9  UnU[         L a  SnU[         L a  [        nSU0US.nU[         La  [        U5      US   S'   [        [        U ]7  U5        Xl        g )N   
stacklevelFenabled)uniformBucketLevelAccesspublicAccessPreventionr   
lockedTime)_defaultrT   _UBLA_BPO_ENABLED_MESSAGEwarningswarn_BPO_ENABLED_MESSAGEDeprecationWarning_UBLA_BPO_LOCK_TIME_MESSAGE_BPO_LOCK_TIME_MESSAGEr"   r   rU   r   rV   _bucket)	rW   r<   public_access_prevention#uniform_bucket_level_access_enabled'uniform_bucket_level_access_locked_timebucket_policy_only_enabledbucket_policy_only_locked_timedatard   s	           r6   rV   IAMConfiguration.__init__  s     &X52(B !:;;MM.0BqQ2L/)96hF !<==MM02DQRS6T3.(:27/#x/'I$ >) '?	
 3(B=Q7>D+,\: 	.t4r8   c                 8    U " U5      nUR                  U5        U$ )a   Factory:  construct instance from resource.

:type bucket: :class:`Bucket`
:params bucket: Bucket for which this instance is the policy.

:type resource: dict
:param resource: mapping as returned from API call.

:rtype: :class:`IAMConfiguration`
:returns: Instance created from resource.
rh   rj   rk   r<   rl   s       r6   rB   IAMConfiguration.from_api_repr       v;!r8   c                     U R                   $ zhBucket for which this instance is the policy.

:rtype: :class:`Bucket`
:returns: the instance's bucket.
r   rq   s    r6   r<   IAMConfiguration.bucket       ||r8   c                     U S   $ )a  Setting for public access prevention policy. Options are 'inherited' (default) or 'enforced'.

    See: https://cloud.google.com/storage/docs/public-access-prevention

:rtype: string
:returns: the public access prevention status, either 'enforced' or 'inherited'.
r   r/   rq   s    r6   r   )IAMConfiguration.public_access_prevention  s     ,--r8   c                 D    XS'   U R                   R                  SU 5        g )Nr   iamConfigurationr<   _patch_propertyrW   values     r6   r   r   '  s     ).%&##$6=r8   c                 J    U R                  S0 5      nUR                  SS5      $ )zIf set, access checks only use bucket-level IAM policies or above.

:rtype: bool
:returns: whether the bucket is configured to allow only IAM.
r   r   Frp   )rW   ublas     r6   r   4IAMConfiguration.uniform_bucket_level_access_enabled,  s&     xx2B7xx	5))r8   c                 |    U R                  S0 5      n[        U5      US'   U R                  R                  SU 5        g )Nr   r   r   )
setdefaultboolr<   r   )rW   r   r   s      r6   r   r   6  s5    92>u+Y##$6=r8   c                 h    U R                  S0 5      nUR                  S5      nUb  [        U5      nU$ )a  Deadline for changing :attr:`uniform_bucket_level_access_enabled` from true to false.

If the bucket's :attr:`uniform_bucket_level_access_enabled` is true, this property
is time time after which that setting becomes immutable.

If the bucket's :attr:`uniform_bucket_level_access_enabled` is false, this property
is ``None``.

:rtype: Union[:class:`datetime.datetime`, None]
:returns:  (readonly) Time after which :attr:`uniform_bucket_level_access_enabled` will
           be frozen as true.
r   r   r1   r   )rW   r   stamps      r6   r   8IAMConfiguration.uniform_bucket_level_access_locked_time<  s8     xx2B7&.u5Er8   c                     U R                   $ )zDeprecated alias for :attr:`uniform_bucket_level_access_enabled`.

:rtype: bool
:returns: whether the bucket is configured to allow only IAM.
)r   rq   s    r6   r   +IAMConfiguration.bucket_policy_only_enabledP  s     777r8   c                 L    [         R                  " [        [        SS9  Xl        g )Nr   r   )r   r   r   r   r   r   s     r6   r   r   Y  s    *,>1M380r8   c                     U R                   $ )zDeprecated alias for :attr:`uniform_bucket_level_access_locked_time`.

:rtype: Union[:class:`datetime.datetime`, None]
:returns:
    (readonly) Time after which :attr:`bucket_policy_only_enabled` will
    be frozen as true.
)r   rq   s    r6   r   /IAMConfiguration.bucket_policy_only_locked_time^  s     ;;;r8   )r   r   )r   r   r   r   r   r   rV   r   rB   r   r<   r   setterr   r   r   r   r   r   r   s   @r6   r   r     s    > "*,408#+'/(T      . . $$> %> * * )//> 0>
  & 8 8  &&9 '9 < <r8   r   c                     ^  \ rS rSrSrSr \\\\	\
\\4r \\\4r SiU 4S jjrS r\S 5       rU 4S jr\S	 5       r\R0                  S
 5       r\S 5       r\S 5       r\S 5       r\S 5       r\U 4S j5       r\SjS j5       r\SjS j5       r     SkS jr!SSSSS\"S4S jr#S\$SSSS\%4S jr&SSSSSS\$\%4S jr'S\$SS\(4U 4S jjr)SS\$SSSS\%S4	U 4S jjr*S\$SS\(4U 4S jjr+\S 5       r,\S 5       r-\.S 5       r/\S 5       r0SSSSSSSSS\$\%S4S jr1SSSSSSSSSSS\$\%SSSS4S  jr2S\$\%4S! jr3S\$\%4S" jr4SSSS\$\%4S# jr5SSSSSS\$\%4S$ jr6SSS\$SSSS\%4	S% jr7SSS&SSSSSSSSS\$\84S' jr9SSSSSSSSS\$\84S( jr:SSSSSSSSS\$\84S) jr;SSSSSSSS\$\84
S* jr<\S+ 5       r=\=R0                  S, 5       r=\>" S-5      r? \S. 5       r@\@R0                  S/ 5       r@\S0 5       rA\AR0                  S1 5       rA\S2 5       rB\S3 5       rC\S4 5       rD\S5 5       rE\S6 5       rF\FR0                  S7 5       rFS8 rGS9 rHS: rIS; rJS< rK\>" S=5      rL\S> 5       rM\MR0                  S? 5       rM\S@ 5       rN\SA 5       rOSB rPSlSC jrQSD rR\SE 5       rS\SF 5       rT\SG 5       rU\SH 5       rV\SI 5       rW\SJ 5       rX\XR0                  SK 5       rX\SL 5       rY\SM 5       rZ\ZR0                  SN 5       rZ\SO 5       r[\SP 5       r\\SQ 5       r]\]R0                  SR 5       r]\SS 5       r^\^R0                  ST 5       r^\SU 5       r_\_R0                  SV 5       r_\SW 5       r`\SX 5       ra\aR0                  SY 5       ra\SZ 5       rb\S[ 5       rc\S\ 5       rd\dR0                  S] 5       rdSmS^ jreS_ rfSS\$\%4S` jrgS\$\h4Sa jriS\$\%4Sb jrjSSS\$SS\(4Sc jrkSSS\$SS\(4Sd jrlSmSe jrmS\$\%4Sf jrn           SnSg jroShrpU =rq$ )oBucketij  a~  A class representing a Bucket on Cloud Storage.

:type client: :class:`google.cloud.storage.client.Client`
:param client: A client which holds credentials and project configuration
               for the bucket (which requires a project).

:type name: str
:param name: The name of the bucket. Bucket names must start and end with a
             number or letter.

:type user_project: str
:param user_project: (Optional) the project ID to be billed for API
                     requests made via this instance.

:type generation: int
:param generation: (Optional) If present, selects a specific revision of
                   this bucket.
   Nc                    > [        U5      n[        [        U ]  US9  Xl        [        U 5      U l        [        U 5      U l        [        5       U l
        X0l        Ub  X@R                  S'   gg)z2
property :attr:`name`
    Get the bucket's name.
r:   N
generation)r   rU   r   rV   _clientr   _aclr   _default_object_aclset_label_removals_user_project_properties)rW   clientr:   user_projectr   rd   s        r6   rV   Bucket.__init__  sg    
 d#fd$$$/dO	#3D#9 "u)!-7\* "r8   c                 "    SU R                    S3$ )Nz	<Bucket: >r   rq   s    r6   __repr__Bucket.__repr__  s    499+Q''r8   c                     U R                   $ )z The client bound to this bucket.)r   rq   s    r6   r   Bucket.client  s     ||r8   c                 ^   > U R                   R                  5         [        [        U ]  U5      $ )zSet the properties for the current object.

:type value: dict or :class:`google.cloud.storage.batch._FutureDict`
:param value: The properties to be set.
)r   clearrU   r   r=   )rW   r   rd   s     r6   r=   Bucket._set_properties  s)     	""$VT2599r8   c                 8    U R                   R                  S5      $ )zGet the RPO (Recovery Point Objective) of this bucket

See: https://cloud.google.com/storage/docs/managing-turbo-replication

"ASYNC_TURBO" or "DEFAULT"
:rtype: str
rpor   r1   rq   s    r6   r  
Bucket.rpo  s     ##E**r8   c                 (    U R                  SU5        g)z
Set the RPO (Recovery Point Objective) of this bucket.

See: https://cloud.google.com/storage/docs/managing-turbo-replication

:type value: str
:param value: "ASYNC_TURBO" or "DEFAULT"
r  Nr   r   s     r6   r  r    s     	UE*r8   c                     U R                   $ )a"  Project ID to be billed for API requests made via this bucket.

If unset, API requests are billed to the bucket owner.

A user project is required for all operations on Requester Pays buckets.

See https://cloud.google.com/storage/docs/requester-pays#requirements for details.

:rtype: str
)r   rq   s    r6   r  Bucket.user_project  s     !!!r8   c                 V    U R                   R                  S5      nUb  [        U5      $ g)zRetrieve the generation for the bucket.

:rtype: int or ``NoneType``
:returns: The generation of the bucket or ``None`` if the bucket's
          resource has not been loaded from the server.
r   Nr   r1   int)rW   r   s     r6   r   Bucket.generation  s/     %%)),7
!z?" "r8   c                 V    U R                   R                  S5      nUb  [        U5      $ g)a  If this bucket has been soft-deleted, returns the time at which it became soft-deleted.

:rtype: :class:`datetime.datetime` or ``NoneType``
:returns:
    (readonly) The time that the bucket became soft-deleted.
     Note this property is only set for soft-deleted buckets.
softDeleteTimeNr   r1   r   )rW   soft_delete_times     r6   r  Bucket.soft_delete_time  3      ++//0@A'-.>?? (r8   c                 V    U R                   R                  S5      nUb  [        U5      $ g)a   If this bucket has been soft-deleted, returns the time at which it will be permanently deleted.

:rtype: :class:`datetime.datetime` or ``NoneType``
:returns:
    (readonly) The time that the bucket will be permanently deleted.
    Note this property is only set for soft-deleted buckets.
hardDeleteTimeNr  )rW   hard_delete_times     r6   r   Bucket.hard_delete_time  r  r8   c                    > [         TU ]  nU$ )zDefault query parameters.)rU   _query_params)rW   paramsrd   s     r6   r#  Bucket._query_params	  s     &r8   c                 N    [        U5      u  p4pVnUS:w  a  [        S5      eU " X$S9$ )aT  Get a constructor for bucket object by URI.

.. code-block:: python

    from google.cloud import storage
    from google.cloud.storage.bucket import Bucket
    client = storage.Client()
    bucket = Bucket.from_uri("gs://bucket", client=client)

:type uri: str
:param uri: The bucket uri pass to get bucket object.

:type client: :class:`~google.cloud.storage.client.Client` or
              ``NoneType``
:param client: (Optional) The client to use.  Application code should
    *always* pass ``client``.

:rtype: :class:`google.cloud.storage.bucket.Bucket`
:returns: The bucket object created.
gszURI scheme must be gsr   )r   rT   )rj   urir   schemenetlocpathqueryfrags           r6   from_uriBucket.from_uri  s2    , -5SM)TT>4556''r8   c                 d    [         R                  " [        [        SS9  [        R                  XS9$ )a  Get a constructor for bucket object by URI.

.. note::
   Deprecated alias for :meth:`from_uri`.

.. code-block:: python

    from google.cloud import storage
    from google.cloud.storage.bucket import Bucket
    client = storage.Client()
    bucket = Bucket.from_string("gs://bucket", client=client)

:type uri: str
:param uri: The bucket uri pass to get bucket object.

:type client: :class:`~google.cloud.storage.client.Client` or
              ``NoneType``
:param client: (Optional) The client to use.  Application code should
    *always* pass ``client``.

:rtype: :class:`google.cloud.storage.bucket.Bucket`
:returns: The bucket object created.
r   r   )r(  r   )r   r   _FROM_STRING_MESSAGEPendingDeprecationWarningr   r.  )rj   r(  r   s      r6   from_stringBucket.from_string,  s(    2 	*,ERST366r8   c           	          [        UU UUUUS9$ )as  Factory constructor for blob object.

.. note::
  This will not make an HTTP request; it simply instantiates
  a blob object owned by this bucket.

:type blob_name: str
:param blob_name: The name of the blob to be instantiated.

:type chunk_size: int
:param chunk_size: The size of a chunk of data whenever iterating
                   (in bytes). This must be a multiple of 256 KB per
                   the API specification.

:type encryption_key: bytes
:param encryption_key:
    (Optional) 32 byte encryption key for customer-supplied encryption.

:type kms_key_name: str
:param kms_key_name:
    (Optional) Resource name of KMS key used to encrypt blob's content.

:type generation: long
:param generation: (Optional) If present, selects a specific revision of
                   this object.

:rtype: :class:`google.cloud.storage.blob.Blob`
:returns: The blob object created.
)r:   r<   
chunk_sizeencryption_keykms_key_namer   r   )rW   	blob_namer6  r7  r8  r   s         r6   r?   Bucket.blobH  s$    J !)%!
 	
r8   c                 "    [        U UUUUUUUS9$ )zFactory:  create a notification resource for the bucket.

See: :class:`.BucketNotification` for parameters.

:rtype: :class:`.BucketNotification`
)
topic_nametopic_projectcustom_attributesevent_typesblob_name_prefixpayload_formatnotification_idr&   )rW   r<  r=  r>  r?  r@  rA  rB  s           r6   notificationBucket.notificationv  s)      "!'/#-)+	
 		
r8   c           
      L   [        SS9   U R                  U5      nSS0nU R                  b  U R                  US'   [        UUUS9  0 n	[	        U	UUS9   UR                  U R                  UU	UUSS	9   SSS5        g! [         a     SSS5        g
f = f! , (       d  f       g= f)aD  Determines whether or not this bucket exists.

If :attr:`user_project` is set, bills the API request to that project.

:type client: :class:`~google.cloud.storage.client.Client` or
              ``NoneType``
:param client: (Optional) The client to use. If not passed, falls back
               to the ``client`` stored on the current bucket.

:type timeout: float or tuple
:param timeout:
    (Optional) The amount of time, in seconds, to wait
    for the server response.  See: :ref:`configuring_timeouts`

:type if_etag_match: Union[str, Set[str]]
:param if_etag_match: (Optional) Make the operation conditional on whether the
                      bucket's current ETag matches the given value.

:type if_etag_not_match: Union[str, Set[str]])
:param if_etag_not_match: (Optional) Make the operation conditional on whether the
                          bucket's current ETag does not match the given value.

:type if_metageneration_match: long
:param if_metageneration_match: (Optional) Make the operation conditional on whether the
                                bucket's current metageneration matches the given value.

:type if_metageneration_not_match: long
:param if_metageneration_not_match: (Optional) Make the operation conditional on whether the
                                    bucket's current metageneration does not match the given value.

:type retry: google.api_core.retry.Retry or google.cloud.storage.retry.ConditionalRetryPolicy
:param retry:
    (Optional) How to retry the RPC. See: :ref:`configuring_retries`

:rtype: bool
:returns: True if the bucket exists in Cloud Storage.
zStorage.Bucket.existsr   fieldsr:   NuserProjectif_metageneration_matchif_metageneration_not_match)if_etag_matchif_etag_not_match)query_paramsheaderstimeoutretry_target_objectFT)r   _require_clientr  r   r
   _get_resourcer+  r   )
rW   r   rO  rK  rL  rI  rJ  rP  rM  rN  s
             r6   existsBucket.exists  s    ^ $;<))&1F %f-L  ,.2.?.?]+,(?,G G#+"3 $$II!-###' %  M =<B   K =<BC =<s0   A
BA=3B=
BBBB
B#Fc	                     [        SS9   U R                  U5      nUR                  U UU R                  UUUUUUS9	  SSS5        g! , (       d  f       g= f)a  Creates current bucket.

If the bucket already exists, will raise
:class:`google.cloud.exceptions.Conflict`.

This implements "storage.buckets.insert".

If :attr:`user_project` is set, bills the API request to that project.

:type client: :class:`~google.cloud.storage.client.Client` or
              ``NoneType``
:param client: (Optional) The client to use. If not passed, falls back
               to the ``client`` stored on the current bucket.

:type project: str
:param project: (Optional) The project under which the bucket is to
                be created. If not passed, uses the project set on
                the client.
:raises ValueError: if ``project`` is None and client's
                    :attr:`project` is also None.

:type location: str
:param location: (Optional) The location of the bucket. If not passed,
                 the default location, US, will be used. See
                 https://cloud.google.com/storage/docs/bucket-locations

:type predefined_acl: str
:param predefined_acl:
    (Optional) Name of predefined ACL to apply to bucket. See:
    https://cloud.google.com/storage/docs/access-control/lists#predefined-acl

:type predefined_default_object_acl: str
:param predefined_default_object_acl:
    (Optional) Name of predefined ACL to apply to bucket's objects. See:
    https://cloud.google.com/storage/docs/access-control/lists#predefined-acl

:type enable_object_retention: bool
:param enable_object_retention:
    (Optional) Whether object retention should be enabled on this bucket. See:
    https://cloud.google.com/storage/docs/object-lock

:type timeout: float or tuple
:param timeout:
    (Optional) The amount of time, in seconds, to wait
    for the server response.  See: :ref:`configuring_timeouts`

:type retry: google.api_core.retry.Retry or google.cloud.storage.retry.ConditionalRetryPolicy
:param retry:
    (Optional) How to retry the RPC. See: :ref:`configuring_retries`
zStorage.Bucket.creater   )	bucket_or_nameprojectr  locationpredefined_aclpredefined_default_object_aclenable_object_retentionrO  rP  N)r   rR  create_bucketr  )	rW   r   rX  rY  rZ  r[  r\  rO  rP  s	            r6   createBucket.create  s^    z $;<))&1F  #!..!-.K(? ! 
 =<<s   3A
Ac           	      v   > [        SS9   [        [        U ]  UUUUUS9  SSS5        g! , (       d  f       g= f)a  Sends all properties in a PUT request.

Updates the ``_properties`` with the response from the backend.

If :attr:`user_project` is set, bills the API request to that project.

:type client: :class:`~google.cloud.storage.client.Client` or
              ``NoneType``
:param client: the client to use. If not passed, falls back to the
               ``client`` stored on the current object.

:type timeout: float or tuple
:param timeout:
    (Optional) The amount of time, in seconds, to wait
    for the server response.  See: :ref:`configuring_timeouts`

:type if_metageneration_match: long
:param if_metageneration_match: (Optional) Make the operation conditional on whether the
                                blob's current metageneration matches the given value.

:type if_metageneration_not_match: long
:param if_metageneration_not_match: (Optional) Make the operation conditional on whether the
                                    blob's current metageneration does not match the given value.

:type retry: google.api_core.retry.Retry or google.cloud.storage.retry.ConditionalRetryPolicy
:param retry:
    (Optional) How to retry the RPC. See: :ref:`configuring_retries`
zStorage.Bucket.updater   r   rO  rI  rJ  rP  N)r   rU   r   r2   )rW   r   rO  rI  rJ  rP  rd   s         r6   r2   Bucket.update3  s>    H $;<&$&(?,G '  =<<s   *
8noAclc
                 ~   > [        SS9   [        [        U ]  UUUUUUUUU	S9	  SSS5        g! , (       d  f       g= f)a  Reload properties from Cloud Storage.

If :attr:`user_project` is set, bills the API request to that project.

:type client: :class:`~google.cloud.storage.client.Client` or
              ``NoneType``
:param client: the client to use. If not passed, falls back to the
               ``client`` stored on the current object.

:type projection: str
:param projection: (Optional) If used, must be 'full' or 'noAcl'.
                   Defaults to ``'noAcl'``. Specifies the set of
                   properties to return.

:type timeout: float or tuple
:param timeout:
    (Optional) The amount of time, in seconds, to wait
    for the server response.  See: :ref:`configuring_timeouts`

:type if_etag_match: Union[str, Set[str]]
:param if_etag_match: (Optional) Make the operation conditional on whether the
                      bucket's current ETag matches the given value.

:type if_etag_not_match: Union[str, Set[str]])
:param if_etag_not_match: (Optional) Make the operation conditional on whether the
                          bucket's current ETag does not match the given value.

:type if_metageneration_match: long
:param if_metageneration_match: (Optional) Make the operation conditional on whether the
                                bucket's current metageneration matches the given value.

:type if_metageneration_not_match: long
:param if_metageneration_not_match: (Optional) Make the operation conditional on whether the
                                    bucket's current metageneration does not match the given value.

:type retry: google.api_core.retry.Retry or google.cloud.storage.retry.ConditionalRetryPolicy
:param retry:
    (Optional) How to retry the RPC. See: :ref:`configuring_retries`

:type soft_deleted: bool
:param soft_deleted: (Optional) If True, looks for a soft-deleted
    bucket. Will only return the bucket metadata if the bucket exists
    and is in a soft-deleted state. The bucket ``generation`` must be
    set if ``soft_deleted`` is set to True.
    See: https://cloud.google.com/storage/docs/soft-delete
zStorage.Bucket.reloadr   )	r   
projectionrO  rK  rL  rI  rJ  rP  soft_deletedN)r   rU   r   reload)rW   r   re  rO  rK  rL  rI  rJ  rP  rf  rd   s             r6   rg  Bucket.reload`  sJ    t $;<&$&%+"3(?,G) ' 
 =<<s   .
<c           	      P  > [        SS9   U R                  (       a\  U R                  R                  S5        U R                  R                  S0 5        U R                   H  nSU R                  S   U'   M     [        [        U ]#  UUUUUS9  SSS5        g! , (       d  f       g= f)a  Sends all changed properties in a PATCH request.

Updates the ``_properties`` with the response from the backend.

If :attr:`user_project` is set, bills the API request to that project.

:type client: :class:`~google.cloud.storage.client.Client` or
              ``NoneType``
:param client: the client to use. If not passed, falls back to the
               ``client`` stored on the current object.

:type timeout: float or tuple
:param timeout:
    (Optional) The amount of time, in seconds, to wait
    for the server response.  See: :ref:`configuring_timeouts`

:type if_metageneration_match: long
:param if_metageneration_match: (Optional) Make the operation conditional on whether the
                                blob's current metageneration matches the given value.

:type if_metageneration_not_match: long
:param if_metageneration_not_match: (Optional) Make the operation conditional on whether the
                                    blob's current metageneration does not match the given value.

:type retry: google.api_core.retry.Retry or google.cloud.storage.retry.ConditionalRetryPolicy
:param retry:
    (Optional) How to retry the RPC. See: :ref:`configuring_retries`
zStorage.Bucket.patchr   labelsN)r   rI  rJ  rO  rP  )	r   r   _changesaddr   r   rU   r   patch)rW   r   rO  rI  rJ  rP  removed_labelrd   s          r6   rm  Bucket.patch  s    H $:; ##!!(+  ++Hb9%)%9%9M@DD$$X.}= &: &$%(?,G &  <;;s   BB
B%c                     U R                   $ )zCreate our ACL on demand.)r   rq   s    r6   acl
Bucket.acl  s     yyr8   c                     U R                   $ )z&Create our defaultObjectACL on demand.)r   rq   s    r6   default_object_aclBucket.default_object_acl  s     '''r8   c                     SU -   $ )zRelative URL path for a bucket.

:type bucket_name: str
:param bucket_name: The bucket name in the path.

:rtype: str
:returns: The relative URL path for ``bucket_name``.
/b/r/   )bucket_names    r6   path_helperBucket.path_helper  s     {""r8   c                 p    U R                   (       d  [        S5      eU R                  U R                   5      $ )zThe URL path to this bucket.z*Cannot determine path without bucket name.)r:   rT   ry  rq   s    r6   r+  Bucket.path  s,     yyIJJ		**r8   c                     [        SS9   [        SU UUUS.UD6n UR                  UUUUUUU	U
UUS9
  UsSSS5        $ ! [         a     SSS5        gf = f! , (       d  f       g= f)a	  Get a blob object by name.

See a [code sample](https://cloud.google.com/storage/docs/samples/storage-get-metadata#storage_get_metadata-python)
on how to retrieve metadata of an object.

If :attr:`user_project` is set, bills the API request to that project.

:type blob_name: str
:param blob_name: The name of the blob to retrieve.

:type client: :class:`~google.cloud.storage.client.Client` or
              ``NoneType``
:param client: (Optional) The client to use.  If not passed, falls back
               to the ``client`` stored on the current bucket.

:type encryption_key: bytes
:param encryption_key:
    (Optional) 32 byte encryption key for customer-supplied encryption.
    See
    https://cloud.google.com/storage/docs/encryption#customer-supplied.

:type generation: long
:param generation:
    (Optional) If present, selects a specific revision of this object.

:type if_etag_match: Union[str, Set[str]]
:param if_etag_match:
    (Optional) See :ref:`using-if-etag-match`

:type if_etag_not_match: Union[str, Set[str]]
:param if_etag_not_match:
    (Optional) See :ref:`using-if-etag-not-match`

:type if_generation_match: long
:param if_generation_match:
    (Optional) See :ref:`using-if-generation-match`

:type if_generation_not_match: long
:param if_generation_not_match:
    (Optional) See :ref:`using-if-generation-not-match`

:type if_metageneration_match: long
:param if_metageneration_match:
    (Optional) See :ref:`using-if-metageneration-match`

:type if_metageneration_not_match: long
:param if_metageneration_not_match:
    (Optional) See :ref:`using-if-metageneration-not-match`

:type timeout: float or tuple
:param timeout:
    (Optional) The amount of time, in seconds, to wait
    for the server response.  See: :ref:`configuring_timeouts`

:type retry: google.api_core.retry.Retry or google.cloud.storage.retry.ConditionalRetryPolicy
:param retry:
    (Optional) How to retry the RPC. See: :ref:`configuring_retries`

:type soft_deleted: bool
:param soft_deleted:
    (Optional) If True, looks for a soft-deleted object. Will only return
    the object metadata if the object exists and is in a soft-deleted state.
    Object ``generation`` is required if ``soft_deleted`` is set to True.
    See: https://cloud.google.com/storage/docs/soft-delete

:param kwargs: Keyword arguments to pass to the
               :class:`~google.cloud.storage.blob.Blob` constructor.

:rtype: :class:`google.cloud.storage.blob.Blob` or None
:returns: The blob object if it exists, otherwise None.
zStorage.Bucket.getBlobr   )r<   r:   r7  r   )
r   rO  rK  rL  if_generation_matchif_generation_not_matchrI  rJ  rP  rf  Nr/   )r   r   rg  r   )rW   r9  r   r7  r   rK  rL  r~  r  rI  rJ  rO  rP  rf  kwargsr?   s                   r6   get_blobBucket.get_blob  s    p $<= -%	
 D !#"/&7(;,C,C0K!-   7 >=0  3 >=01 >=s+   A?A
A	AAA
A%c                     [        SS9   U R                  U5      nUR                  U UUUUUUUUU	U
UUUUUUS9sSSS5        $ ! , (       d  f       g= f)a  Return an iterator used to find blobs in the bucket.

If :attr:`user_project` is set, bills the API request to that project.

:type max_results: int
:param max_results:
    (Optional) The maximum number of blobs to return.

:type page_token: str
:param page_token:
    (Optional) If present, return the next batch of blobs, using the
    value, which must correspond to the ``nextPageToken`` value
    returned in the previous response.  Deprecated: use the ``pages``
    property of the returned iterator instead of manually passing the
    token.

:type prefix: str
:param prefix: (Optional) Prefix used to filter blobs.

:type delimiter: str
:param delimiter: (Optional) Delimiter, used with ``prefix`` to
                  emulate hierarchy.

:type start_offset: str
:param start_offset:
    (Optional) Filter results to objects whose names are
    lexicographically equal to or after ``startOffset``. If
    ``endOffset`` is also set, the objects listed will have names
    between ``startOffset`` (inclusive) and ``endOffset`` (exclusive).

:type end_offset: str
:param end_offset:
    (Optional) Filter results to objects whose names are
    lexicographically before ``endOffset``. If ``startOffset`` is also
    set, the objects listed will have names between ``startOffset``
    (inclusive) and ``endOffset`` (exclusive).

:type include_trailing_delimiter: boolean
:param include_trailing_delimiter:
    (Optional) If true, objects that end in exactly one instance of
    ``delimiter`` will have their metadata included in ``items`` in
    addition to ``prefixes``.

:type versions: bool
:param versions: (Optional) Whether object versions should be returned
                 as separate blobs.

:type projection: str
:param projection: (Optional) If used, must be 'full' or 'noAcl'.
                   Defaults to ``'noAcl'``. Specifies the set of
                   properties to return.

:type fields: str
:param fields:
    (Optional) Selector specifying which fields to include
    in a partial response. Must be a list of fields. For
    example to get a partial response with just the next
    page token and the name and language of each blob returned:
    ``'items(name,contentLanguage),nextPageToken'``.
    See: https://cloud.google.com/storage/docs/json_api/v1/parameters#fields

:type client: :class:`~google.cloud.storage.client.Client`
:param client: (Optional) The client to use.  If not passed, falls back
               to the ``client`` stored on the current bucket.

:type timeout: float or tuple
:param timeout:
    (Optional) The amount of time, in seconds, to wait
    for the server response.  See: :ref:`configuring_timeouts`

:type retry: google.api_core.retry.Retry or google.cloud.storage.retry.ConditionalRetryPolicy
:param retry:
    (Optional) How to retry the RPC. See: :ref:`configuring_retries`

:type match_glob: str
:param match_glob:
    (Optional) A glob pattern used to filter results (for example, foo*bar).
    The string value must be UTF-8 encoded. See:
    https://cloud.google.com/storage/docs/json_api/v1/objects/list#list-object-glob

:type include_folders_as_prefixes: bool
    (Optional) If true, includes Folders and Managed Folders in the set of
    ``prefixes`` returned by the query. Only applicable if ``delimiter`` is set to /.
    See: https://cloud.google.com/storage/docs/managed-folders

:type soft_deleted: bool
:param soft_deleted:
    (Optional) If true, only soft-deleted objects will be listed as distinct results in order of increasing
    generation number. This parameter can only be used successfully if the bucket has a soft delete policy.
    Note ``soft_deleted`` and ``versions`` cannot be set to True simultaneously. See:
    https://cloud.google.com/storage/docs/soft-delete

:type page_size: int
:param page_size:
    (Optional) Maximum number of blobs to return in each page.
    Defaults to a value set by the API.

:rtype: :class:`~google.api_core.page_iterator.Iterator`
:returns: Iterator of all :class:`~google.cloud.storage.blob.Blob`
          in this bucket matching the arguments.
zStorage.Bucket.listBlobsr   )max_results
page_tokenprefix	delimiterstart_offset
end_offsetinclude_trailing_delimiterversionsre  rF  	page_sizerO  rP  
match_globinclude_folders_as_prefixesrf  N)r   rR  
list_blobs)rW   r  r  r  r  r  r  r  r  re  rF  r   rO  rP  r  r  rf  r  s                     r6   r  Bucket.list_blobsp  sq    r $>?))&1F$$'%#)%+E!%#%,G)# %  @??s   0A
Ac                     [        SS9   U R                  U5      nU R                  S-   nUR                  U[        UUS9nXl        UsSSS5        $ ! , (       d  f       g= f)aG  List Pub / Sub notifications for this bucket.

See:
https://cloud.google.com/storage/docs/json_api/v1/notifications/list

If :attr:`user_project` is set, bills the API request to that project.

:type client: :class:`~google.cloud.storage.client.Client` or
              ``NoneType``
:param client: (Optional) The client to use.  If not passed, falls back
               to the ``client`` stored on the current bucket.
:type timeout: float or tuple
:param timeout:
    (Optional) The amount of time, in seconds, to wait
    for the server response.  See: :ref:`configuring_timeouts`

:type retry: google.api_core.retry.Retry or google.cloud.storage.retry.ConditionalRetryPolicy
:param retry:
    (Optional) How to retry the RPC. See: :ref:`configuring_retries`

:rtype: list of :class:`.BucketNotification`
:returns: notification instances
z Storage.Bucket.listNotificationsr   z/notificationConfigs)rO  rP  N)r   rR  r+  _list_resourcerC   r<   )rW   r   rO  rP  r+  r3   s         r6   list_notificationsBucket.list_notifications  sd    4 $FG))&1F9955D,,%	 - H #O HGGs   >A
A c                     [        SS9   U R                  US9nUR                  X#US9  UsSSS5        $ ! , (       d  f       g= f)ab  Get Pub / Sub notification for this bucket.

See [API reference docs](https://cloud.google.com/storage/docs/json_api/v1/notifications/get)
and a [code sample](https://cloud.google.com/storage/docs/samples/storage-print-pubsub-bucket-notification#storage_print_pubsub_bucket_notification-python).

If :attr:`user_project` is set, bills the API request to that project.

:type notification_id: str
:param notification_id: The notification id to retrieve the notification configuration.

:type client: :class:`~google.cloud.storage.client.Client` or
              ``NoneType``
:param client: (Optional) The client to use.  If not passed, falls back
               to the ``client`` stored on the current bucket.
:type timeout: float or tuple
:param timeout:
    (Optional) The amount of time, in seconds, to wait
    for the server response.  See: :ref:`configuring_timeouts`

:type retry: google.api_core.retry.Retry or google.cloud.storage.retry.ConditionalRetryPolicy
:param retry:
    (Optional) How to retry the RPC. See: :ref:`configuring_retries`

:rtype: :class:`.BucketNotification`
:returns: notification instance.
zStorage.Bucket.getNotificationr   )rB  )r   rO  rP  N)r   rC  rg  )rW   rB  r   rO  rP  rC  s         r6   get_notificationBucket.get_notification%  sD    B $DE,,_,MLveL FEEs	   !5
Ac                    [        SS9   U R                  U5      n0 nU R                  b  U R                  US'   [        UUUS9  U(       ar  [	        U R                  U R                  S-   UUUSS95      n[        U5      U R                  :  a  S	U R                  4-  n	[        U	5      eU R                  US
 UUUSS9  UR                  U R                  UUUSS9  SSS5        g! , (       d  f       g= f)a  Delete this bucket.

The bucket **must** be empty in order to submit a delete request. If
``force=True`` is passed, this will first attempt to delete all the
objects / blobs in the bucket (i.e. try to empty the bucket).

If the bucket doesn't exist, this will raise
:class:`google.cloud.exceptions.NotFound`. If the bucket is not empty
(and ``force=False``), will raise :class:`google.cloud.exceptions.Conflict`.

If ``force=True`` and the bucket contains more than 256 objects / blobs
this will cowardly refuse to delete the objects (or the bucket). This
is to prevent accidental bucket deletion and to prevent extremely long
runtime of this method. Also note that ``force=True`` is not supported
in a ``Batch`` context.

If :attr:`user_project` is set, bills the API request to that project.

:type force: bool
:param force: If True, empties the bucket's objects then deletes it.

:type client: :class:`~google.cloud.storage.client.Client` or
              ``NoneType``
:param client: (Optional) The client to use. If not passed, falls back
               to the ``client`` stored on the current bucket.

:type if_metageneration_match: long
:param if_metageneration_match: (Optional) Make the operation conditional on whether the
                                blob's current metageneration matches the given value.

:type if_metageneration_not_match: long
:param if_metageneration_not_match: (Optional) Make the operation conditional on whether the
                                    blob's current metageneration does not match the given value.

:type timeout: float or tuple
:param timeout:
    (Optional) The amount of time, in seconds, to wait
    for the server response.  See: :ref:`configuring_timeouts`

:type retry: google.api_core.retry.Retry or google.cloud.storage.retry.ConditionalRetryPolicy
:param retry:
    (Optional) How to retry the RPC. See: :ref:`configuring_retries`

:raises: :class:`ValueError` if ``force`` is ``True`` and the bucket
         contains more than 256 objects / blobs.
zStorage.Bucket.deleter   NrG  rH     T)r  r   rO  rP  r  zRefusing to delete bucket with more than %d objects. If you actually want to delete this bucket, please delete the objects yourself before calling Bucket.delete().c                     g Nr/   )r?   s    r6   <lambda>Bucket.delete.<locals>.<lambda>  s    $r8   )on_errorr   rO  rP  preserve_generationrM  rO  rP  rQ  )r   rR  r  r   listr  _MAX_OBJECTS_FOR_ITERATIONlenrT   delete_blobs_delete_resourcer+  )
rW   forcer   rI  rJ  rO  rP  rM  blobsmessages
             r6   deleteBucket.deleteK  s"   n $;<))&1FL  ,.2.?.?]+,(?,G
 OO$($C$Ca$G% '#!% $  u: ? ??C 88:;G %W-- !!.!#(, "  ##		)# $ Y =<<s   CC$$
C2c
           	         [        SS9   U R                  U5      n[        XUS9n
[        R                  " U
R
                  5      n[        UUUUUS9  UR                  U
R                  UUU	SS9  SSS5        g! , (       d  f       g= f)a	  Deletes a blob from the current bucket.

If :attr:`user_project` is set, bills the API request to that project.

:type blob_name: str
:param blob_name: A blob name to delete.

:type client: :class:`~google.cloud.storage.client.Client` or
              ``NoneType``
:param client: (Optional) The client to use. If not passed, falls back
               to the ``client`` stored on the current bucket.

:type generation: long
:param generation: (Optional) If present, permanently deletes a specific
                   revision of this object.

:type if_generation_match: long
:param if_generation_match:
    (Optional) See :ref:`using-if-generation-match`

:type if_generation_not_match: long
:param if_generation_not_match:
    (Optional) See :ref:`using-if-generation-not-match`

:type if_metageneration_match: long
:param if_metageneration_match:
    (Optional) See :ref:`using-if-metageneration-match`

:type if_metageneration_not_match: long
:param if_metageneration_not_match:
    (Optional) See :ref:`using-if-metageneration-not-match`

:type timeout: float or tuple
:param timeout:
    (Optional) The amount of time, in seconds, to wait
    for the server response.  See: :ref:`configuring_timeouts`

:type retry: google.api_core.retry.Retry or google.cloud.storage.retry.ConditionalRetryPolicy
:param retry: (Optional) How to retry the RPC. A None value will disable
    retries. A google.api_core.retry.Retry value will enable retries,
    and the object will define retriable response codes and errors and
    configure backoff and timeout options.

    A google.cloud.storage.retry.ConditionalRetryPolicy value wraps a
    Retry object and activates it only if certain conditions are met.
    This class exists to provide safe defaults for RPC calls that are
    not technically safe to retry normally (due to potential data
    duplication or other side-effects) but become safe to retry if a
    condition such as if_generation_match is set.

    See the retry.py source code and docstrings in this package
    (google.cloud.storage.retry) for information on retry types and how
    to configure them.

:raises: :class:`google.cloud.exceptions.NotFound` Raises a NotFound
         if the blob isn't found. To suppress
         the exception, use :meth:`delete_blobs` by passing a no-op
         ``on_error`` callback.
zStorage.Bucket.deleteBlobr   )r<   r   r~  r  rI  rJ  Nr  )	r   rR  r   copydeepcopyr#  r   r  r+  )rW   r9  r   r   r~  r  rI  rJ  rO  rP  r?   rM  s               r6   delete_blobBucket.delete_blob  s    N $?@))&1F	:FD==););<L,$7(?(?,G ##		)# $  A@@s   A&A99
Bc                 V   [        SS9   [        [        U5      UUUU	S9  [        U=(       d    / 5      n[        U=(       d    / 5      n[        U=(       d    / 5      n[        U	=(       d    / 5      n	U H}  n UnSn[	        U[
        5      (       d!  UR                  nU(       a  UR                  OSnU R                  UUU[        US5      [        US5      [        US5      [        U	S5      UU
S9	  M     SSS5        g! [         a    Ub  U" U5         M  e f = f! , (       d  f       g= f)a9  Deletes a list of blobs from the current bucket.

Uses :meth:`delete_blob` to delete each individual blob.

By default, any generation information in the list of blobs is ignored, and the
live versions of all blobs are deleted. Set `preserve_generation` to True
if blob generation should instead be propagated from the list of blobs.

If :attr:`user_project` is set, bills the API request to that project.

:type blobs: list
:param blobs: A list of :class:`~google.cloud.storage.blob.Blob`-s or
              blob names to delete.

:type on_error: callable
:param on_error: (Optional) Takes single argument: ``blob``.
                 Called once for each blob raising
                 :class:`~google.cloud.exceptions.NotFound`;
                 otherwise, the exception is propagated.
                 Note that ``on_error`` is not supported in a ``Batch`` context.

:type client: :class:`~google.cloud.storage.client.Client`
:param client: (Optional) The client to use.  If not passed, falls back
               to the ``client`` stored on the current bucket.

:type preserve_generation: bool
:param preserve_generation: (Optional) Deletes only the generation specified on the blob object,
                            instead of the live version, if set to True. Only :class:~google.cloud.storage.blob.Blob
                            objects can have their generation set in this way.
                            Default: False.

:type if_generation_match: list of long
:param if_generation_match:
    (Optional) See :ref:`using-if-generation-match`
    Note that the length of the list must match the length of
    The list must match ``blobs`` item-to-item.

:type if_generation_not_match: list of long
:param if_generation_not_match:
    (Optional) See :ref:`using-if-generation-not-match`
    The list must match ``blobs`` item-to-item.

:type if_metageneration_match: list of long
:param if_metageneration_match:
    (Optional) See :ref:`using-if-metageneration-match`
    The list must match ``blobs`` item-to-item.

:type if_metageneration_not_match: list of long
:param if_metageneration_not_match:
    (Optional) See :ref:`using-if-metageneration-not-match`
    The list must match ``blobs`` item-to-item.

:type timeout: float or tuple
:param timeout:
    (Optional) The amount of time, in seconds, to wait
    for the server response.  See: :ref:`configuring_timeouts`

:type retry: google.api_core.retry.Retry or google.cloud.storage.retry.ConditionalRetryPolicy
:param retry: (Optional) How to retry the RPC. A None value will disable
    retries. A google.api_core.retry.Retry value will enable retries,
    and the object will define retriable response codes and errors and
    configure backoff and timeout options.

    A google.cloud.storage.retry.ConditionalRetryPolicy value wraps a
    Retry object and activates it only if certain conditions are met.
    This class exists to provide safe defaults for RPC calls that are
    not technically safe to retry normally (due to potential data
    duplication or other side-effects) but become safe to retry if a
    condition such as if_generation_match is set.

    See the retry.py source code and docstrings in this package
    (google.cloud.storage.retry) for information on retry types and how
    to configure them.

:raises: :class:`~google.cloud.exceptions.NotFound` (if
         `on_error` is not passed).
zStorage.Bucket.deleteBlobsr   r  N)r   r   r~  r  rI  rJ  rO  rP  )r   _raise_if_len_differsr  iter
isinstancestrr:   r   r  nextr   )rW   r  r  r   r  rO  r~  r  rI  rJ  rP  r?   r9  r   s                 r6   r  Bucket.delete_blobs  s4   t $@A!E
$7(?(?,G #'':'@b"A&*+B+Hb&I#&*+B+Hb&I#*./J/Pb*Q' $I!%J%i55$(II	8KT__QU
$$!%#-,01Dd,K045Ld0S045Ld0S4875 !(# %   BAD   + 	E BAs1   A,D7A9C=0D=DDDD
D(Tc                    [        SS9   U R                  U5      n0 nU R                  b  U R                  US'   Ub  UUS'   [        UUUU	U
UUUUS9	  Uc  UR                  n[        X#S9nUR                  S-   UR                  -   nUR                  USUUUUS	9nU(       d  UR                  R                  0 XOS
9  UR                  U5        UsSSS5        $ ! , (       d  f       g= f)ah  Copy the given blob to the given bucket, optionally with a new name.

If :attr:`user_project` is set, bills the API request to that project.

See [API reference docs](https://cloud.google.com/storage/docs/json_api/v1/objects/copy)
and a [code sample](https://cloud.google.com/storage/docs/samples/storage-copy-file#storage_copy_file-python).

:type blob: :class:`google.cloud.storage.blob.Blob`
:param blob: The blob to be copied.

:type destination_bucket: :class:`google.cloud.storage.bucket.Bucket`
:param destination_bucket: The bucket into which the blob should be
                           copied.

:type new_name: str
:param new_name: (Optional) The new name for the copied file.

:type client: :class:`~google.cloud.storage.client.Client` or
              ``NoneType``
:param client: (Optional) The client to use. If not passed, falls back
               to the ``client`` stored on the current bucket.

:type preserve_acl: bool
:param preserve_acl: DEPRECATED. This argument is not functional!
                     (Optional) Copies ACL from old blob to new blob.
                     Default: True.
                     Note that ``preserve_acl`` is not supported in a
                     ``Batch`` context.

:type source_generation: long
:param source_generation: (Optional) The generation of the blob to be
                          copied.

:type if_generation_match: long
:param if_generation_match:
    (Optional) See :ref:`using-if-generation-match`
    Note that the generation to be matched is that of the
    ``destination`` blob.

:type if_generation_not_match: long
:param if_generation_not_match:
    (Optional) See :ref:`using-if-generation-not-match`
    Note that the generation to be matched is that of the
    ``destination`` blob.

:type if_metageneration_match: long
:param if_metageneration_match:
    (Optional) See :ref:`using-if-metageneration-match`
    Note that the metageneration to be matched is that of the
    ``destination`` blob.

:type if_metageneration_not_match: long
:param if_metageneration_not_match:
    (Optional) See :ref:`using-if-metageneration-not-match`
    Note that the metageneration to be matched is that of the
    ``destination`` blob.

:type if_source_generation_match: long
:param if_source_generation_match:
    (Optional) Makes the operation conditional on whether the source
    object's generation matches the given value.

:type if_source_generation_not_match: long
:param if_source_generation_not_match:
    (Optional) Makes the operation conditional on whether the source
    object's generation does not match the given value.

:type if_source_metageneration_match: long
:param if_source_metageneration_match:
    (Optional) Makes the operation conditional on whether the source
    object's current metageneration matches the given value.

:type if_source_metageneration_not_match: long
:param if_source_metageneration_not_match:
    (Optional) Makes the operation conditional on whether the source
    object's current metageneration does not match the given value.

:type timeout: float or tuple
:param timeout:
    (Optional) The amount of time, in seconds, to wait
    for the server response.  See: :ref:`configuring_timeouts`

:type retry: google.api_core.retry.Retry or google.cloud.storage.retry.ConditionalRetryPolicy
:param retry:
    (Optional) How to retry the RPC.
    The default value is ``DEFAULT_RETRY_IF_GENERATION_SPECIFIED``, a conditional retry
    policy which will only enable retries if ``if_generation_match`` or ``generation``
    is set, in order to ensure requests are idempotent before retrying them.
    Change the value to ``DEFAULT_RETRY`` or another `google.api_core.retry.Retry` object
    to enable retries regardless of generation precondition setting.
    See [Configuring Retries](https://cloud.google.com/python/docs/reference/storage/latest/retry_timeout).

:rtype: :class:`google.cloud.storage.blob.Blob`
:returns: The new Blob.
zStorage.Bucket.copyBlobr   NrG  sourceGenerationr~  r  rI  rJ  if_source_generation_matchif_source_generation_not_matchif_source_metageneration_match"if_source_metageneration_not_matchr<   r:   z/copyTor  )rq  r   rO  )r   rR  r  r   r:   r   r+  _post_resourcerq  saver=   )rW   r?   destination_bucketnew_namer   preserve_aclsource_generationr~  r  rI  rJ  r  r  r  r  rO  rP  rM  new_blobapi_pathcopy_results                        r6   	copy_blobBucket.copy_blob  s   d $=>))&1FL  ,.2.?.?]+ ,3D/0,$7(?(?,G+E/M/M3U
 99#5EHyy9,x}}<H //)' 0 K  !!b!I$$[1Q ?>>s   CC
C&c                     [        SS9   UR                  U:H  nU R                  UU UUUUUUUUU	U
UUS9nU(       d  UR                  UUUU	U
UUS9  UsSSS5        $ ! , (       d  f       g= f)a  Rename the given blob using copy and delete operations.

If :attr:`user_project` is set, bills the API request to that project.

Effectively, copies blob to the same bucket with a new name, then
deletes the blob.

.. warning::

  This method will first duplicate the data and then delete the
  old blob.  This means that with very large objects renaming
  could be a very (temporarily) costly or a very slow operation.
  If you need more control over the copy and deletion, instead
  use ``google.cloud.storage.blob.Blob.copy_to`` and
  ``google.cloud.storage.blob.Blob.delete`` directly.

  Also note that this method is not fully supported in a
  ``Batch`` context.

:type blob: :class:`google.cloud.storage.blob.Blob`
:param blob: The blob to be renamed.

:type new_name: str
:param new_name: The new name for this blob.

:type client: :class:`~google.cloud.storage.client.Client` or
              ``NoneType``
:param client: (Optional) The client to use.  If not passed, falls back
               to the ``client`` stored on the current bucket.

:type if_generation_match: long
:param if_generation_match:
    (Optional) See :ref:`using-if-generation-match`
    Note that the generation to be matched is that of the
    ``destination`` blob.

:type if_generation_not_match: long
:param if_generation_not_match:
    (Optional) See :ref:`using-if-generation-not-match`
    Note that the generation to be matched is that of the
    ``destination`` blob.

:type if_metageneration_match: long
:param if_metageneration_match:
    (Optional) See :ref:`using-if-metageneration-match`
    Note that the metageneration to be matched is that of the
    ``destination`` blob.

:type if_metageneration_not_match: long
:param if_metageneration_not_match:
    (Optional) See :ref:`using-if-metageneration-not-match`
    Note that the metageneration to be matched is that of the
    ``destination`` blob.

:type if_source_generation_match: long
:param if_source_generation_match:
    (Optional) Makes the operation conditional on whether the source
    object's generation matches the given value. Also used in the
    (implied) delete request.

:type if_source_generation_not_match: long
:param if_source_generation_not_match:
    (Optional) Makes the operation conditional on whether the source
    object's generation does not match the given value. Also used in
    the (implied) delete request.

:type if_source_metageneration_match: long
:param if_source_metageneration_match:
    (Optional) Makes the operation conditional on whether the source
    object's current metageneration matches the given value. Also used
    in the (implied) delete request.

:type if_source_metageneration_not_match: long
:param if_source_metageneration_not_match:
    (Optional) Makes the operation conditional on whether the source
    object's current metageneration does not match the given value.
    Also used in the (implied) delete request.

:type timeout: float or tuple
:param timeout:
    (Optional) The amount of time, in seconds, to wait
    for the server response.  See: :ref:`configuring_timeouts`

:type retry: google.api_core.retry.Retry or google.cloud.storage.retry.ConditionalRetryPolicy
:param retry:
    (Optional) How to retry the RPC.
    The default value is ``DEFAULT_RETRY_IF_GENERATION_SPECIFIED``, a conditional retry
    policy which will only enable retries if ``if_generation_match`` or ``generation``
    is set, in order to ensure requests are idempotent before retrying them.
    Change the value to ``DEFAULT_RETRY`` or another `google.api_core.retry.Retry` object
    to enable retries regardless of generation precondition setting.
    See [Configuring Retries](https://cloud.google.com/python/docs/reference/storage/latest/retry_timeout).

:rtype: :class:`Blob`
:returns: The newly-renamed blob.
zStorage.Bucket.renameBlobr   )r   rO  r~  r  rI  rJ  r  r  r  r  rP  )r   rO  r~  r  rI  rJ  rP  N)r   r:   r  r  )rW   r?   r  r   r~  r  rI  rJ  r  r  r  r  rO  rP  	same_namer  s                   r6   rename_blobBucket.rename_blob2  s    ` $?@		X-I~~$7(?(?,G+E/M/M3U & H" !#(B,J,J0R   = A@@s   A	A
A+c                 b   [        SS9   U R                  U5      n0 nU R                  b  U R                  US'   [        UUUUUUU	U
US9	  [	        XS9nUR
                  S-   UR                  -   nUR                  USUUUUS9nUR                  U5        UsSSS5        $ ! , (       d  f       g= f)	a
  Move a blob to a new name within a single HNS bucket.

*This feature is currently only supported for HNS (Heirarchical
Namespace) buckets.*

If :attr:`user_project` is set on the bucket, bills the API request to that project.

:type blob: :class:`google.cloud.storage.blob.Blob`
:param blob: The blob to be renamed.

:type new_name: str
:param new_name: The new name for this blob.

:type client: :class:`~google.cloud.storage.client.Client` or
              ``NoneType``
:param client: (Optional) The client to use.  If not passed, falls back
               to the ``client`` stored on the current bucket.

:type if_generation_match: int
:param if_generation_match:
    (Optional) See :ref:`using-if-generation-match`
    Note that the generation to be matched is that of the
    ``destination`` blob.

:type if_generation_not_match: int
:param if_generation_not_match:
    (Optional) See :ref:`using-if-generation-not-match`
    Note that the generation to be matched is that of the
    ``destination`` blob.

:type if_metageneration_match: int
:param if_metageneration_match:
    (Optional) See :ref:`using-if-metageneration-match`
    Note that the metageneration to be matched is that of the
    ``destination`` blob.

:type if_metageneration_not_match: int
:param if_metageneration_not_match:
    (Optional) See :ref:`using-if-metageneration-not-match`
    Note that the metageneration to be matched is that of the
    ``destination`` blob.

:type if_source_generation_match: int
:param if_source_generation_match:
    (Optional) Makes the operation conditional on whether the source
    object's generation matches the given value.

:type if_source_generation_not_match: int
:param if_source_generation_not_match:
    (Optional) Makes the operation conditional on whether the source
    object's generation does not match the given value.

:type if_source_metageneration_match: int
:param if_source_metageneration_match:
    (Optional) Makes the operation conditional on whether the source
    object's current metageneration matches the given value.

:type if_source_metageneration_not_match: int
:param if_source_metageneration_not_match:
    (Optional) Makes the operation conditional on whether the source
    object's current metageneration does not match the given value.

:type timeout: float or tuple
:param timeout:
    (Optional) The amount of time, in seconds, to wait
    for the server response.  See: :ref:`configuring_timeouts`

:type retry: google.api_core.retry.Retry
:param retry:
    (Optional) How to retry the RPC.
    See [Configuring Retries](https://cloud.google.com/python/docs/reference/storage/latest/retry_timeout).

:rtype: :class:`Blob`
:returns: The newly-moved blob.
zStorage.Bucket.moveBlobr   NrG  r  r  z
/moveTo/o/r  )	r   rR  r  r   r   r+  r:   r  r=   )rW   r?   r  r   r~  r  rI  rJ  r  r  r  r  rO  rP  rM  r  r  move_results                     r6   	move_blobBucket.move_blob  s    v $=>))&1FL  ,.2.?.?]+,$7(?(?,G+E/M/M3U
 47Hyy</(--?H //)' 0 K $$[1? ?>>s   BB  
B.c           	      d   [        SS9   U R                  U5      n0 nU R                  b  U R                  US'   Ub  X<S'   Ub  XLS'   Ub  X\S'   [        UUUUU	S9  [	        XS	9nUR                  UR                   S
3SUU
US9nUR                  U5        UsSSS5        $ ! , (       d  f       g= f)a  Restores a soft-deleted object.

If :attr:`user_project` is set on the bucket, bills the API request to that project.

See [API reference docs](https://cloud.google.com/storage/docs/json_api/v1/objects/restore)

:type blob_name: str
:param blob_name: The name of the blob to be restored.

:type client: :class:`~google.cloud.storage.client.Client`
:param client: (Optional) The client to use. If not passed, falls back
               to the ``client`` stored on the current bucket.

:type generation: int
:param generation: Selects the specific revision of the object.

:type copy_source_acl: bool
:param copy_source_acl: (Optional) If true, copy the soft-deleted object's access controls.

:type projection: str
:param projection: (Optional) Specifies the set of properties to return.
                   If used, must be 'full' or 'noAcl'.

:type if_generation_match: long
:param if_generation_match:
    (Optional) See :ref:`using-if-generation-match`

:type if_generation_not_match: long
:param if_generation_not_match:
    (Optional) See :ref:`using-if-generation-not-match`

:type if_metageneration_match: long
:param if_metageneration_match:
    (Optional) See :ref:`using-if-metageneration-match`

:type if_metageneration_not_match: long
:param if_metageneration_not_match:
    (Optional) See :ref:`using-if-metageneration-not-match`

:type timeout: float or tuple
:param timeout:
    (Optional) The amount of time, in seconds, to wait
    for the server response.  See: :ref:`configuring_timeouts`

:type retry: google.api_core.retry.Retry or google.cloud.storage.retry.ConditionalRetryPolicy
:param retry:
    (Optional) How to retry the RPC.
    The default value is ``DEFAULT_RETRY_IF_GENERATION_SPECIFIED``, which
    only restore operations with ``if_generation_match`` or ``generation`` set
    will be retried.

    Users can configure non-default retry behavior. A ``None`` value will
    disable retries. A ``DEFAULT_RETRY`` value will enable retries
    even if restore operations are not guaranteed to be idempotent.
    See [Configuring Retries](https://cloud.google.com/python/docs/reference/storage/latest/retry_timeout).

:rtype: :class:`google.cloud.storage.blob.Blob`
:returns: The restored Blob.
zStorage.Bucket.restore_blobr   NrG  r   copySourceAclre  r  r  z/restore)rM  rO  rP  )r   rR  r  r   r   r  r+  r=   )rW   r9  r   r   copy_source_aclre  r~  r  rI  rJ  rO  rP  rM  r?   api_responses                  r6   restore_blobBucket.restore_blob>	  s    R $AB))&1FL  ,.2.?.?]+%-7\**0?_-%-7\*,$7(?(?,G t4D!0099+X&) 1 L   .= CBBs   BB!!
B/c                     U R                   R                  SS5       Vs/ s H  n[        R                  " U5      PM     sn$ s  snf )a  Retrieve or set CORS policies configured for this bucket.

See http://www.w3.org/TR/cors/ and
     https://cloud.google.com/storage/docs/json_api/v1/buckets

.. note::

   The getter for this property returns a list which contains
   *copies* of the bucket's CORS policy mappings.  Mutating the list
   or one of its dicts has no effect unless you then re-assign the
   dict via the setter.  E.g.:

   >>> policies = bucket.cors
   >>> policies.append({'origin': '/foo', ...})
   >>> policies[1]['maxAgeSeconds'] = 3600
   >>> del policies[0]
   >>> bucket.cors = policies
   >>> bucket.update()

:setter: Set CORS policies for this bucket.
:getter: Gets the CORS policies for this bucket.

:rtype: list of dictionaries
:returns: A sequence of mappings describing each CORS policy.
corsr/   r   r1   r  r  rW   policys     r6   r  Bucket.cors	  s;    6 594D4D4H4HQS4TU4T&f%4TUUUs    Ac                 (    U R                  SU5        g)zSet CORS policies configured for this bucket.

See http://www.w3.org/TR/cors/ and
     https://cloud.google.com/storage/docs/json_api/v1/buckets

:type entries: list of dictionaries
:param entries: A sequence of mappings describing each CORS policy.
r  Nr  )rW   entriess     r6   r  r  	  s     	VW-r8   defaultEventBasedHoldc                 \    U R                   R                  S0 5      nUR                  S5      $ )aT  Retrieve / set default KMS encryption key for objects in the bucket.

See https://cloud.google.com/storage/docs/json_api/v1/buckets

:setter: Set default KMS encryption key for items in this bucket.
:getter: Get default KMS encryption key for items in this bucket.

:rtype: str
:returns: Default KMS encryption key, or ``None`` if not set.

encryptiondefaultKmsKeyNamer  )rW   encryption_configs     r6   default_kms_key_nameBucket.default_kms_key_name	  s/     !,,00rB $$%899r8   c                 h    U R                   R                  S0 5      nXS'   U R                  SU5        g)zSet default KMS encryption key for objects in the bucket.

:type value: str or None
:param value: new KMS key name (None to clear any existing key).
r  r  Nr   r1   r   )rW   r   r  s      r6   r  r  	  s7     !,,00rB16-.\+<=r8   c                 n    U R                   R                  S5      nUc  0 $ [        R                  " U5      $ )a  Retrieve or set labels assigned to this bucket.

See
https://cloud.google.com/storage/docs/json_api/v1/buckets#labels

.. note::

   The getter for this property returns a dict which is a *copy*
   of the bucket's labels.  Mutating that dict has no effect unless
   you then re-assign the dict via the setter.  E.g.:

   >>> labels = bucket.labels
   >>> labels['new_key'] = 'some-label'
   >>> del labels['old_key']
   >>> bucket.labels = labels
   >>> bucket.update()

:setter: Set labels for this bucket.
:getter: Gets the labels for this bucket.

:rtype: :class:`dict`
:returns: Name-value pairs (string->string) labelling the bucket.
rj  r  )rW   rj  s     r6   rj  Bucket.labels	  s3    2 !!%%h/>I}}V$$r8   c                    [        U R                  R                  5        Vs/ s H  o"PM     sn5      n[        UR                  5        Vs/ s H  o"PM     sn5      nU R                  R	                  UR                  U5      5      U l        UR                  5        VVs0 s H  u  p%U[        U5      _M     nnnU R                  S[        R                  " U5      5        gs  snf s  snf s  snnf )zSet labels assigned to this bucket.

See
https://cloud.google.com/storage/docs/json_api/v1/buckets#labels

:type mapping: :class:`dict`
:param mapping: Name-value pairs (string->string) labelling the bucket.
rj  N)r   rj  keysr   union
differenceitemsr  r   r  r  )rW   mappingkexistingincomingvs         r6   rj  r  
  s     4;;#3#3#56#5a#5677<<>2>a>23#3399(:M:Mh:WX)091c!f99 	Xt}}W'=> 729s   C!C&C+c                 8    U R                   R                  S5      $ )a&  Retrieve the ETag for the bucket.

See https://tools.ietf.org/html/rfc2616#section-3.11 and
     https://cloud.google.com/storage/docs/json_api/v1/buckets

:rtype: str or ``NoneType``
:returns: The bucket etag or ``None`` if the bucket's
          resource has not been loaded from the server.
etagr  rq   s    r6   r  Bucket.etag+
  s     ##F++r8   c                 8    U R                   R                  S5      $ )zRetrieve the ID for the bucket.

See https://cloud.google.com/storage/docs/json_api/v1/buckets

:rtype: str or ``NoneType``
:returns: The ID of the bucket or ``None`` if the bucket's
          resource has not been loaded from the server.
idr  rq   s    r6   r  	Bucket.id8
  s     ##D))r8   c                 d    U R                   R                  S0 5      n[        R                  X5      $ )zRetrieve IAM configuration for this bucket.

:rtype: :class:`IAMConfiguration`
:returns: an instance for managing the bucket's IAM configuration.
r   )r   r1   r   rB   rW   infos     r6   iam_configurationBucket.iam_configurationD
  s.     ##$6;--d99r8   c                 d    U R                   R                  S0 5      n[        R                  X5      $ )zRetrieve the soft delete policy for this bucket.

See https://cloud.google.com/storage/docs/soft-delete

:rtype: :class:`SoftDeletePolicy`
:returns: an instance for managing the bucket's soft delete policy.
softDeletePolicy)r   r1   SoftDeletePolicyrB   r  s     r6   soft_delete_policyBucket.soft_delete_policyN
  s.     !!%%&8"=--f;;r8   c              #     #    U R                   R                  S0 5      nUR                  SS5       H  nUS   S   nUS:X  a  [        R                  U5      v   M*  US:X  a  [        R                  U5      v   MI  US:X  a  [
        R                  U5      v   Mh  [        R                  " S	R                  U5      [        S
S9  M     g7f)a<  Retrieve or set lifecycle rules configured for this bucket.

See https://cloud.google.com/storage/docs/lifecycle and
     https://cloud.google.com/storage/docs/json_api/v1/buckets

.. note::

   The getter for this property returns a generator which yields
   *copies* of the bucket's lifecycle rules mappings.  Mutating the
   output dicts has no effect unless you then re-assign the dict via
   the setter.  E.g.:

   >>> rules = list(bucket.lifecycle_rules)
   >>> rules.append({'origin': '/foo', ...})
   >>> rules[1]['rule']['action']['type'] = 'Delete'
   >>> del rules[0]
   >>> bucket.lifecycle_rules = rules
   >>> bucket.update()

:setter: Set lifecycle rules for this bucket.
:getter: Gets the lifecycle rules for this bucket.

:rtype: generator(dict)
:returns: A sequence of mappings describing each lifecycle rule.
	lifecycler   r/   r   r   r   r   r   zgUnknown lifecycle rule type received: {}. Please upgrade to the latest version of google-cloud-storage.r  r   N)
r   r1   r   rB   r   r   r   r   formatUserWarning)rW   r  r   action_types       r6   lifecycle_rulesBucket.lifecycle_rulesZ
  s     6 ##K4HHVR(Dx.0Kh&)77== 112@@FF @@AOOPTUU}  E  E    )s   CCc                 l    U Vs/ s H  n[        U5      PM     nnU R                  SSU05        gs  snf )a  Set lifecycle rules configured for this bucket.

See https://cloud.google.com/storage/docs/lifecycle and
     https://cloud.google.com/storage/docs/json_api/v1/buckets

:type rules: list of dictionaries
:param rules: A sequence of mappings describing each lifecycle rule.
r  r   N)r   r   )rW   rulesr   s      r6   r  r  
  s5     )..d.[65/: /s   1c                     / U l         g)zClear lifecycle rules configured for this bucket.

See https://cloud.google.com/storage/docs/lifecycle and
     https://cloud.google.com/storage/docs/json_api/v1/buckets
N)r  rq   s    r6   clear_lifecycle_rulesBucket.clear_lifecycle_rules
  s      "r8   c                 "    U R                  5       $ )z+Deprecated alias for clear_lifecycle_rules.)r  rq   s    r6   clear_lifecyle_rulesBucket.clear_lifecyle_rules
  s    ))++r8   c                 n    [        U R                  5      nUR                  [        S0 UD65        X l        g)aV  Add a "delete" rule to lifecycle rules configured for this bucket.

This defines a [lifecycle configuration](https://cloud.google.com/storage/docs/lifecycle),
which is set on the bucket. For the general format of a lifecycle configuration, see the
[bucket resource representation for JSON](https://cloud.google.com/storage/docs/json_api/v1/buckets).
See also a [code sample](https://cloud.google.com/storage/docs/samples/storage-enable-bucket-lifecycle-management#storage_enable_bucket_lifecycle_management-python).

:type kw: dict
:params kw: arguments passed to :class:`LifecycleRuleConditions`.
Nr/   )r  r  appendr   rW   r   r  s      r6   add_lifecycle_delete_rule Bucket.add_lifecycle_delete_rule
  s/     T))*(.2./$r8   c                 p    [        U R                  5      nUR                  [        U40 UD65        X0l        g)a   Add a "set storage class" rule to lifecycle rules.

This defines a [lifecycle configuration](https://cloud.google.com/storage/docs/lifecycle),
which is set on the bucket. For the general format of a lifecycle configuration, see the
[bucket resource representation for JSON](https://cloud.google.com/storage/docs/json_api/v1/buckets).

:type storage_class: str, one of :attr:`STORAGE_CLASSES`.
:param storage_class: new storage class to assign to matching items.

:type kw: dict
:params kw: arguments passed to :class:`LifecycleRuleConditions`.
N)r  r  r  r   )rW   r   r   r  s       r6   $add_lifecycle_set_storage_class_rule+Bucket.add_lifecycle_set_storage_class_rule
  s1     T))*1-F2FG$r8   c                 n    [        U R                  5      nUR                  [        S0 UD65        X l        g)a  Add a "abort incomplete multipart upload" rule to lifecycle rules.

.. note::
  The "age" lifecycle condition is the only supported condition
  for this rule.

This defines a [lifecycle configuration](https://cloud.google.com/storage/docs/lifecycle),
which is set on the bucket. For the general format of a lifecycle configuration, see the
[bucket resource representation for JSON](https://cloud.google.com/storage/docs/json_api/v1/buckets).

:type kw: dict
:params kw: arguments passed to :class:`LifecycleRuleConditions`.
Nr/   )r  r  r  r   r  s      r6   4add_lifecycle_abort_incomplete_multipart_upload_rule;Bucket.add_lifecycle_abort_incomplete_multipart_upload_rule
  s/     T))*@F2FG$r8   rY  c                     U R                   $ )aB  Retrieve location configured for this bucket.

See https://cloud.google.com/storage/docs/json_api/v1/buckets and
https://cloud.google.com/storage/docs/locations

Returns ``None`` if the property has not been set before creation,
or if the bucket's resource has not been loaded from the server.
:rtype: str or ``NoneType``
)	_locationrq   s    r6   rY  Bucket.location
  s     ~~r8   c                 L    [         R                  " [        [        SS9  Xl        g)a{  (Deprecated) Set `Bucket.location`

This can only be set at bucket **creation** time.

See https://cloud.google.com/storage/docs/json_api/v1/buckets and
https://cloud.google.com/storage/docs/bucket-locations

.. warning::

    Assignment to 'Bucket.location' is deprecated, as it is only
    valid before the bucket is created. Instead, pass the location
    to `Bucket.create`.
r   r   N)r   r   _LOCATION_SETTER_MESSAGEr   r!  r   s     r6   rY  r"  
  s     	.0BqQr8   c                 \    U R                   R                  S0 5      nUR                  S5      $ )a  Retrieve the list of regional locations for custom dual-region buckets.

See https://cloud.google.com/storage/docs/json_api/v1/buckets and
https://cloud.google.com/storage/docs/locations

Returns ``None`` if the property has not been set before creation,
if the bucket's resource has not been loaded from the server,
or if the bucket is not a dual-regions bucket.
:rtype: list of str or ``NoneType``
customPlacementConfigdataLocationsr  )rW   custom_placement_configs     r6   data_locationsBucket.data_locations
  s0     #'"2"2"6"67NPR"S&**?;;r8   c                 8    U R                   R                  S5      $ )a  Retrieve the location type for the bucket.

See https://cloud.google.com/storage/docs/storage-classes

:getter: Gets the the location type for this bucket.

:rtype: str or ``NoneType``
:returns:
    If set, one of
    :attr:`~google.cloud.storage.constants.MULTI_REGION_LOCATION_TYPE`,
    :attr:`~google.cloud.storage.constants.REGION_LOCATION_TYPE`, or
    :attr:`~google.cloud.storage.constants.DUAL_REGION_LOCATION_TYPE`,
    else ``None``.
locationTyper  rq   s    r6   location_typeBucket.location_type  s      ##N33r8   c                 d    U R                   R                  S5      n[        R                  " U5      $ )zReturn info about access logging for this bucket.

See https://cloud.google.com/storage/docs/access-logs#status

:rtype: dict or None
:returns: a dict w/ keys, ``logBucket`` and ``logObjectPrefix``
          (if logging is enabled), or None (if not).
loggingr  r  s     r6   get_loggingBucket.get_logging  s)     ##I.}}T""r8   c                 0    XS.nU R                  SU5        g)a  Enable access logging for this bucket.

See https://cloud.google.com/storage/docs/access-logs

:type bucket_name: str
:param bucket_name: name of bucket in which to store access logs

:type object_prefix: str
:param object_prefix: prefix for access log filenames
)	logBucketlogObjectPrefixr0  Nr  )rW   rx  object_prefixr  s       r6   enable_loggingBucket.enable_logging   s     )KY-r8   c                 (    U R                  SS5        g)ziDisable access logging for this bucket.

See https://cloud.google.com/storage/docs/access-logs#disabling
r0  Nr  rq   s    r6   disable_loggingBucket.disable_logging.  s    
 	Y-r8   c                 V    U R                   R                  S5      nUb  [        U5      $ g)a  Retrieve the metageneration for the bucket.

See https://cloud.google.com/storage/docs/json_api/v1/buckets

:rtype: int or ``NoneType``
:returns: The metageneration of the bucket or ``None`` if the bucket's
          resource has not been loaded from the server.
metagenerationNr  )rW   r=  s     r6   r=  Bucket.metageneration5  s1     ))--.>?%~&& &r8   c                 `    [         R                  " U R                  R                  S5      5      $ )a	  Retrieve info about the owner of the bucket.

See https://cloud.google.com/storage/docs/json_api/v1/buckets

:rtype: dict or ``NoneType``
:returns: Mapping of owner's role/ID. Returns ``None`` if the bucket's
          resource has not been loaded from the server.
owner)r  r  r   r1   rq   s    r6   r@  Bucket.ownerC  s$     }}T--11':;;r8   c                 V    U R                   R                  S5      nUb  [        U5      $ g)a&  Retrieve the number of the project to which the bucket is assigned.

See https://cloud.google.com/storage/docs/json_api/v1/buckets

:rtype: int or ``NoneType``
:returns: The project number that owns the bucket or ``None`` if
          the bucket's resource has not been loaded from the server.
projectNumberNr  )rW   project_numbers     r6   rD  Bucket.project_numberO  s0     ))--o>%~&& &r8   c                     U R                   R                  S5      nUb   UR                  S5      nUb  [        U5      $ gg)zRetrieve the effective time of the bucket's retention policy.

:rtype: datetime.datetime or ``NoneType``
:returns: point-in time at which the bucket's retention policy is
          effective, or ``None`` if the property is not
          set locally.
retentionPolicyNeffectiveTimer  )rW   r  	timestamps      r6   retention_policy_effective_time&Bucket.retention_policy_effective_time]  sJ     !!%%&78

?3I$1)<< % r8   c                 b    U R                   R                  S5      nUb  UR                  S5      $ g)zRetrieve whthere the bucket's retention policy is locked.

:rtype: bool
:returns: True if the bucket's policy is locked, or else False
          if the policy is not locked, or the property is not
          set locally.
rG  NisLockedr  r  s     r6   retention_policy_lockedBucket.retention_policy_lockedl  s5     !!%%&78::j)) r8   c                     U R                   R                  S5      nUb   UR                  S5      nUb  [        U5      $ gg)zRetrieve or set the retention period for items in the bucket.

:rtype: int or ``NoneType``
:returns: number of seconds to retain items after upload or release
          from event-based lock, or ``None`` if the property is not
          set locally.
rG  NretentionPeriodr  )rW   r  periods      r6   retention_periodBucket.retention_periody  sJ     !!%%&78ZZ 12F!6{" " r8   c                     U R                   R                  S0 5      nUb  [        U5      US'   OSnU R                  SU5        g)zSet the retention period for items in the bucket.

:type value: int
:param value:
    number of seconds to retain items after upload or release from
    event-based lock.

:raises ValueError: if the bucket's retention policy is locked.
rG  NrQ  )r   r   r  r   )rW   r   r  s      r6   rS  rT    sH     !!,,->C(+E
F$%F.7r8   c                 8    U R                   R                  S5      $ )zRetrieve the URI for the bucket.

See https://cloud.google.com/storage/docs/json_api/v1/buckets

:rtype: str or ``NoneType``
:returns: The self link for the bucket or ``None`` if
          the bucket's resource has not been loaded from the server.
selfLinkr  rq   s    r6   	self_linkBucket.self_link  s     ##J//r8   c                 8    U R                   R                  S5      $ )a1  Retrieve or set the storage class for the bucket.

See https://cloud.google.com/storage/docs/storage-classes

:setter: Set the storage class for this bucket.
:getter: Gets the the storage class for this bucket.

:rtype: str or ``NoneType``
:returns:
    If set, one of
    :attr:`~google.cloud.storage.constants.NEARLINE_STORAGE_CLASS`,
    :attr:`~google.cloud.storage.constants.COLDLINE_STORAGE_CLASS`,
    :attr:`~google.cloud.storage.constants.ARCHIVE_STORAGE_CLASS`,
    :attr:`~google.cloud.storage.constants.STANDARD_STORAGE_CLASS`,
    :attr:`~google.cloud.storage.constants.MULTI_REGIONAL_LEGACY_STORAGE_CLASS`,
    :attr:`~google.cloud.storage.constants.REGIONAL_LEGACY_STORAGE_CLASS`,
    or
    :attr:`~google.cloud.storage.constants.DURABLE_REDUCED_AVAILABILITY_LEGACY_STORAGE_CLASS`,
    else ``None``.
r   r  rq   s    r6   r   Bucket.storage_class  s    , ##N33r8   c                 (    U R                  SU5        g)a  Set the storage class for the bucket.

See https://cloud.google.com/storage/docs/storage-classes

:type value: str
:param value:
    One of
    :attr:`~google.cloud.storage.constants.NEARLINE_STORAGE_CLASS`,
    :attr:`~google.cloud.storage.constants.COLDLINE_STORAGE_CLASS`,
    :attr:`~google.cloud.storage.constants.ARCHIVE_STORAGE_CLASS`,
    :attr:`~google.cloud.storage.constants.STANDARD_STORAGE_CLASS`,
    :attr:`~google.cloud.storage.constants.MULTI_REGIONAL_LEGACY_STORAGE_CLASS`,
    :attr:`~google.cloud.storage.constants.REGIONAL_LEGACY_STORAGE_CLASS`,
    or
    :attr:`~google.cloud.storage.constants.DURABLE_REDUCED_AVAILABILITY_LEGACY_STORAGE_CLASS`,
r   Nr  r   s     r6   r   r[    s    $ 	^U3r8   c                 V    U R                   R                  S5      nUb  [        U5      $ g)aH  Retrieve the timestamp at which the bucket was created.

See https://cloud.google.com/storage/docs/json_api/v1/buckets

:rtype: :class:`datetime.datetime` or ``NoneType``
:returns: Datetime object parsed from RFC3339 valid timestamp, or
          ``None`` if the bucket's resource has not been loaded
          from the server.
timeCreatedNr  r   s     r6   time_createdBucket.time_created  s0       $$]3-e44 r8   c                 V    U R                   R                  S5      nUb  [        U5      $ g)aM  Retrieve the timestamp at which the bucket was last updated.

See https://cloud.google.com/storage/docs/json_api/v1/buckets

:rtype: :class:`datetime.datetime` or ``NoneType``
:returns: Datetime object parsed from RFC3339 valid timestamp, or
          ``None`` if the bucket's resource has not been loaded
          from the server.
updatedNr  r   s     r6   rb  Bucket.updated  s0       $$Y/-e44 r8   c                 ^    U R                   R                  S0 5      nUR                  SS5      $ )a%  Is versioning enabled for this bucket?

See  https://cloud.google.com/storage/docs/object-versioning for
details.

:setter: Update whether versioning is enabled for this bucket.
:getter: Query whether versioning is enabled for this bucket.

:rtype: bool
:returns: True if enabled, else False.

versioningr   Fr  rW   re  s     r6   versioning_enabledBucket.versioning_enabled  s-     %%)),;
~~i//r8   c                 >    U R                  SS[        U5      05        g)zEnable versioning for this bucket.

See  https://cloud.google.com/storage/docs/object-versioning for
details.

:type value: convertible to boolean
:param value: should versioning be enabled for the bucket?
re  r   Nr   r   r   s     r6   rg  rh     s     	\ItE{+CDr8   c                 ^    U R                   R                  S0 5      nUR                  SS5      $ )aV  Does the requester pay for API requests for this bucket?

See https://cloud.google.com/storage/docs/requester-pays for
details.

:setter: Update whether requester pays for this bucket.
:getter: Query whether requester pays for this bucket.

:rtype: bool
:returns: True if requester pays for API requests for the bucket,
          else False.
billingrequesterPaysFr  rf  s     r6   requester_paysBucket.requester_pays  s-     %%)))R8
~~ou55r8   c                 >    U R                  SS[        U5      05        g)zUpdate whether requester pays for API requests for this bucket.

See https://cloud.google.com/storage/docs/using-requester-pays for
details.

:type value: convertible to boolean
:param value: should requester pay for API requests for the bucket?
rl  rm  Nrj  r   s     r6   rn  ro    s     	Y$u+(FGr8   c                 ^    U R                   R                  S0 5      nUR                  SS5      $ )a'  Whether Autoclass is enabled for this bucket.

See https://cloud.google.com/storage/docs/using-autoclass for details.

:setter: Update whether autoclass is enabled for this bucket.
:getter: Query whether autoclass is enabled for this bucket.

:rtype: bool
:returns: True if enabled, else False.
	autoclassr   Fr  rW   rr  s     r6   autoclass_enabledBucket.autoclass_enabled)  s-     $$((b9	}}Y..r8   c                 |    U R                   R                  S0 5      n[        U5      US'   U R                  SU5        g)a  Enable or disable Autoclass at the bucket-level.

See https://cloud.google.com/storage/docs/using-autoclass for details.

:type value: convertible to boolean
:param value: If true, enable Autoclass for this bucket.
              If false, disable Autoclass for this bucket.
rr  r   Nr   r1   r   r   rW   r   rr  s      r6   rt  ru  8  s:     $$((b9	#E{	)[)4r8   c                     U R                   R                  S5      nUb   UR                  S5      nUb  [        U5      $ gg)zRetrieve the toggle time when Autoclaass was last enabled or disabled for the bucket.
:rtype: datetime.datetime or ``NoneType``
:returns: point-in time at which the bucket's autoclass is toggled, or ``None`` if the property is not set locally.
rr  N
toggleTimer  rW   rr  rI  s      r6   autoclass_toggle_timeBucket.autoclass_toggle_timeF  sI     $$((5	 !l3I$1)<< % !r8   c                 ^    U R                   R                  S0 5      nUR                  SS5      $ )a  The storage class that objects in an Autoclass bucket eventually transition to if
they are not read for a certain length of time. Valid values are NEARLINE and ARCHIVE.

See https://cloud.google.com/storage/docs/using-autoclass for details.

:setter: Set the terminal storage class for Autoclass configuration.
:getter: Get the terminal storage class for Autoclass configuration.

:rtype: str
:returns: The terminal storage class if Autoclass is enabled, else ``None``.
rr  terminalStorageClassNr  rs  s     r6    autoclass_terminal_storage_class'Bucket.autoclass_terminal_storage_classR  s.     $$((b9	}}3T::r8   c                 h    U R                   R                  S0 5      nXS'   U R                  SU5        g)aI  The storage class that objects in an Autoclass bucket eventually transition to if
they are not read for a certain length of time. Valid values are NEARLINE and ARCHIVE.

See https://cloud.google.com/storage/docs/using-autoclass for details.

:type value: str
:param value: The only valid values are `"NEARLINE"` and `"ARCHIVE"`.
rr  r  Nr  rx  s      r6   r  r  b  s5     $$((b9	,1()[)4r8   c                     U R                   R                  S5      nUb   UR                  S5      nUb  [        U5      $ gg)a  The time at which the Autoclass terminal_storage_class field was last updated for this bucket
:rtype: datetime.datetime or ``NoneType``
:returns: point-in time at which the bucket's terminal_storage_class is last updated, or ``None`` if the property is not set locally.
rr  NterminalStorageClassUpdateTimer  r{  s      r6   ,autoclass_terminal_storage_class_update_time3Bucket.autoclass_terminal_storage_class_update_timep  sJ     $$((5	 !&FGI$1)<< % !r8   c                 b    U R                   R                  S5      nUb  UR                  S5      $ g)zRetrieve the object retention mode set on the bucket.

:rtype: str
:returns: When set to Enabled, retention configurations can be
          set on objects in the bucket.
objectRetentionNmoder  )rW   object_retentions     r6   object_retention_modeBucket.object_retention_mode|  s8      ++//0AB'#''// (r8   c                 \    U R                   R                  S0 5      nUR                  S5      $ )a  Whether hierarchical namespace is enabled for this bucket.

:setter: Update whether hierarchical namespace is enabled for this bucket.
:getter: Query whether hierarchical namespace is enabled for this bucket.

:rtype: bool
:returns: True if enabled, else False.
hierarchicalNamespacer   r  )rW   hnss     r6   hierarchical_namespace_enabled%Bucket.hierarchical_namespace_enabled  s,     ""#:B?wwy!!r8   c                 |    U R                   R                  S0 5      n[        U5      US'   U R                  SU5        g)a  Enable or disable hierarchical namespace at the bucket-level.

:type value: convertible to boolean
:param value: If true, enable hierarchical namespace for this bucket.
              If false, disable hierarchical namespace for this bucket.

.. note::
  To enable hierarchical namespace, you must set it at bucket creation time.
  Currently, hierarchical namespace configuration cannot be changed after bucket creation.
r  r   Nrw  )rW   r   r  s      r6   r  r    s;     ""#:B?eI4c:r8   c                 0    XS.nU R                  SU5        g)a  Configure website-related properties.

See https://cloud.google.com/storage/docs/static-website

.. note::
  This configures the bucket's website-related properties,controlling how
  the service behaves when accessing bucket contents as a web site.
  See [tutorials](https://cloud.google.com/storage/docs/hosting-static-website) and
  [code samples](https://cloud.google.com/storage/docs/samples/storage-define-bucket-website-configuration#storage_define_bucket_website_configuration-python)
  for more information.

:type main_page_suffix: str
:param main_page_suffix: The page to use as the main page
                         of a directory.
                         Typically something like index.html.

:type not_found_page: str
:param not_found_page: The file to use when a page isn't found.
)mainPageSuffixnotFoundPagewebsiteNr  )rW   main_page_suffixnot_found_pager   s       r6   configure_websiteBucket.configure_website  s    ( #3SY-r8   c                 &    U R                  SS5      $ )zDisable the website configuration for this bucket.

This is really just a shortcut for setting the website-related
attributes to ``None``.
N)r  rq   s    r6   disable_websiteBucket.disable_website  s     %%dD11r8   c           	      "   [        SS9   U R                  U5      n0 nU R                  b  U R                  US'   Ub  X%S'   UR                  U R                   S3UUUSS9n[
        R                  " U5      sSSS5        $ ! , (       d  f       g= f)a  Retrieve the IAM policy for the bucket.

See [API reference docs](https://cloud.google.com/storage/docs/json_api/v1/buckets/getIamPolicy)
and a [code sample](https://cloud.google.com/storage/docs/samples/storage-view-bucket-iam-members#storage_view_bucket_iam_members-python).

If :attr:`user_project` is set, bills the API request to that project.

:type client: :class:`~google.cloud.storage.client.Client` or
              ``NoneType``
:param client: (Optional) The client to use.  If not passed, falls back
               to the ``client`` stored on the current bucket.

:type requested_policy_version: int or ``NoneType``
:param requested_policy_version: (Optional) The version of IAM policies to request.
                                 If a policy with a condition is requested without
                                 setting this, the server will return an error.
                                 This must be set to a value of 3 to retrieve IAM
                                 policies containing conditions. This is to prevent
                                 client code that isn't aware of IAM conditions from
                                 interpreting and modifying policies incorrectly.
                                 The service might return a policy with version lower
                                 than the one that was requested, based on the
                                 feature syntax in the policy fetched.

:type timeout: float or tuple
:param timeout:
    (Optional) The amount of time, in seconds, to wait
    for the server response.  See: :ref:`configuring_timeouts`

:type retry: google.api_core.retry.Retry or google.cloud.storage.retry.ConditionalRetryPolicy
:param retry:
    (Optional) How to retry the RPC. See: :ref:`configuring_retries`

:rtype: :class:`google.api_core.iam.Policy`
:returns: the policy instance, based on the resource returned from
          the ``getIamPolicy`` API request.
zStorage.Bucket.getIamPolicyr   NrG  optionsRequestedPolicyVersion/iamr  )r   rR  r  rS  r+  r   rB   )rW   r   requested_policy_versionrO  rP  rM  r  s          r6   get_iam_policyBucket.get_iam_policy  s    X $AB))&1FL  ,.2.?.?]+'3@X<=''99+T")# ( D ''-# CBBs   A,B  
Bc           
      X   [        SS9   U R                  U5      n0 nU R                  b  U R                  US'   U R                   S3nUR	                  5       nU R                  US'   UR                  UUUUUSS9n[        R                  " U5      sSSS5        $ ! , (       d  f       g= f)a  Update the IAM policy for the bucket.

See
https://cloud.google.com/storage/docs/json_api/v1/buckets/setIamPolicy

If :attr:`user_project` is set, bills the API request to that project.

:type policy: :class:`google.api_core.iam.Policy`
:param policy: policy instance used to update bucket's IAM policy.

:type client: :class:`~google.cloud.storage.client.Client` or
              ``NoneType``
:param client: (Optional) The client to use.  If not passed, falls back
               to the ``client`` stored on the current bucket.

:type timeout: float or tuple
:param timeout:
    (Optional) The amount of time, in seconds, to wait
    for the server response.  See: :ref:`configuring_timeouts`

:type retry: google.api_core.retry.Retry or google.cloud.storage.retry.ConditionalRetryPolicy
:param retry:
    (Optional) How to retry the RPC. See: :ref:`configuring_retries`

:rtype: :class:`google.api_core.iam.Policy`
:returns: the policy instance, based on the resource returned from
          the ``setIamPolicy`` API request.
zStorage.Bucket.setIamPolicyr   NrG  r  
resourceIdr  )r   rR  r  r+  to_api_repr_put_resourcer   rB   )	rW   r  r   rO  rP  rM  r+  rk   r  s	            r6   set_iam_policyBucket.set_iam_policy  s    F $AB))&1FL  ,.2.?.?]+ii[%D))+H%)YYH\"'')# ( D ''-) CBBs   BB
B)c           	         [        SS9   U R                  U5      nSU0nU R                  b  U R                  US'   U R                   S3nUR	                  UUUUSS9nUR                  S/ 5      sSSS5        $ ! , (       d  f       g= f)a  API call:  test permissions

See
https://cloud.google.com/storage/docs/json_api/v1/buckets/testIamPermissions

If :attr:`user_project` is set, bills the API request to that project.

:type permissions: list of string
:param permissions: the permissions to check

:type client: :class:`~google.cloud.storage.client.Client` or
              ``NoneType``
:param client: (Optional) The client to use.  If not passed, falls back
               to the ``client`` stored on the current bucket.

:type timeout: float or tuple
:param timeout:
    (Optional) The amount of time, in seconds, to wait
    for the server response.  See: :ref:`configuring_timeouts`

:type retry: google.api_core.retry.Retry or google.cloud.storage.retry.ConditionalRetryPolicy
:param retry:
    (Optional) How to retry the RPC. See: :ref:`configuring_retries`

:rtype: list of string
:returns: the permissions returned by the ``testIamPermissions`` API
          request.
z!Storage.Bucket.testIamPermissionsr   permissionsNrG  z/iam/testPermissionsr  )r   rR  r  r+  rS  r1   )rW   r  r   rO  rP  rM  r+  resps           r6   test_iam_permissionsBucket.test_iam_permissions<  s    > $GH))&1F);7L  ,.2.?.?]+ii[ 45D'')# ( D 88M2. IHHs   A%A99
Bc           
         [        SS9   U R                  R                  5       R                  5         U R                  R	                  UUUUUS9  U(       a]  U R
                  nUR                  (       d  UR                  X4S9  UR                  5       R                  5         UR	                  UUUUUS9  U(       a  [        U R                  SU R                  S-   UUS95      n	[        U	5      U R                  :  a  SU R                  4-  n
[        U
5      eU	 HE  nUR                  R                  5       R                  5         UR                  R	                  UUS9  MG     S	S	S	5        g	! , (       d  f       g	= f)
aq  Update bucket's ACL, granting read access to anonymous users.

:type recursive: bool
:param recursive: If True, this will make all blobs inside the bucket
                  public as well.

:type future: bool
:param future: If True, this will make all objects created in the
               future public as well.

:type client: :class:`~google.cloud.storage.client.Client` or
              ``NoneType``
:param client: (Optional) The client to use.  If not passed, falls back
               to the ``client`` stored on the current bucket.
:type timeout: float or tuple
:param timeout:
    (Optional) The amount of time, in seconds, to wait
    for the server response.  See: :ref:`configuring_timeouts`

:type if_metageneration_match: long
:param if_metageneration_match: (Optional) Make the operation conditional on whether the
                                blob's current metageneration matches the given value.

:type if_metageneration_not_match: long
:param if_metageneration_not_match: (Optional) Make the operation conditional on whether the
                                    blob's current metageneration does not match the given value.

:type retry: google.api_core.retry.Retry or google.cloud.storage.retry.ConditionalRetryPolicy
:param retry:
    (Optional) How to retry the RPC. See: :ref:`configuring_retries`

:raises ValueError:
    If ``recursive`` is True, and the bucket contains more than 256
    blobs.  This is to prevent extremely long runtime of this
    method.  For such buckets, iterate over the blobs returned by
    :meth:`list_blobs` and call
    :meth:`~google.cloud.storage.blob.Blob.make_public`
    for each blob.
zStorage.Bucket.makePublicr   ra  r   rO  fullr  re  r  r   rO  zRefusing to make public recursively with more than %d objects. If you actually want to make every object in this bucket public, iterate through the blobs returned by 'Bucket.list_blobs()' and call 'make_public' on each one.N)r   rq  all
grant_readr  rt  loadedrg  r  r  r  r  rT   rW   	recursivefuturer   rO  rI  rJ  rP  doar  r  r?   s               r6   make_publicBucket.make_publicl  sZ   b $?@HHLLN%%'HHMM(?,G   --zzJJfJ>	$$&!#,C0K   OO#)$($C$Ca$G% '	 $  u: ? ??5
 88:;G %W--!DHHLLN--/HHMM% ' "  "U A@@s   EE++
E9c           
         [        SS9   U R                  R                  5       R                  5         U R                  R	                  UUUUUS9  U(       a]  U R
                  nUR                  (       d  UR                  X4S9  UR                  5       R                  5         UR	                  UUUUUS9  U(       a  [        U R                  SU R                  S-   UUS95      n	[        U	5      U R                  :  a  SU R                  4-  n
[        U
5      eU	 HD  nUR                  R                  5       R                  5         UR                  R	                  X4S9  MF     S	S	S	5        g	! , (       d  f       g	= f)
at  Update bucket's ACL, revoking read access for anonymous users.

:type recursive: bool
:param recursive: If True, this will make all blobs inside the bucket
                  private as well.

:type future: bool
:param future: If True, this will make all objects created in the
               future private as well.

:type client: :class:`~google.cloud.storage.client.Client` or
              ``NoneType``
:param client: (Optional) The client to use.  If not passed, falls back
               to the ``client`` stored on the current bucket.

:type timeout: float or tuple
:param timeout:
    (Optional) The amount of time, in seconds, to wait
    for the server response.  See: :ref:`configuring_timeouts`

:type if_metageneration_match: long
:param if_metageneration_match: (Optional) Make the operation conditional on whether the
                                blob's current metageneration matches the given value.
:type if_metageneration_not_match: long
:param if_metageneration_not_match: (Optional) Make the operation conditional on whether the
                                    blob's current metageneration does not match the given value.
:type retry: google.api_core.retry.Retry or google.cloud.storage.retry.ConditionalRetryPolicy
:param retry:
    (Optional) How to retry the RPC. See: :ref:`configuring_retries`

:raises ValueError:
    If ``recursive`` is True, and the bucket contains more than 256
    blobs.  This is to prevent extremely long runtime of this
    method.  For such buckets, iterate over the blobs returned by
    :meth:`list_blobs` and call
    :meth:`~google.cloud.storage.blob.Blob.make_private`
    for each blob.
zStorage.Bucket.makePrivater   ra  r  r  r  r  zRefusing to make private recursively with more than %d objects. If you actually want to make every object in this bucket private, iterate through the blobs returned by 'Bucket.list_blobs()' and call 'make_private' on each one.N)r   rq  r  revoke_readr  rt  r  rg  r  r  r  r  rT   r  s               r6   make_privateBucket.make_private  sQ   ` $@AHHLLN&&(HHMM(?,G   --zzJJfJ>	%%'!#,C0K   OO#)$($C$Ca$G% '	 $  u: ? ??6
 88:;G %W--!DHHLLN..0HHMMMA "U BAAs   EE**
E8c                 B   U R                  U5      nUR                  n[        R                  " U5        Uc1  [	        [
        5      R                  SS9[        R                  " SS9-   nUSU R                  0/-   n[        U5      US.n[        R                  " [        R                  " U5      R                  S5      5      n[        R                  " UR!                  U5      5      nU R                  UR"                  UR%                  S5      UR%                  S5      S.nU$ )	a6  Create a signed upload policy for uploading objects.

This method generates and signs a policy document. You can use
[`policy documents`](https://cloud.google.com/storage/docs/xml-api/post-object-forms)
to allow visitors to a website to upload files to
Google Cloud Storage without giving them direct write access.
See a [code sample](https://cloud.google.com/storage/docs/xml-api/post-object-forms#python).

:type expiration: datetime
:param expiration: (Optional) Expiration in UTC. If not specified, the
                   policy will expire in 1 hour.

:type conditions: list
:param conditions: A list of conditions as described in the
                  `policy documents` documentation.

:type client: :class:`~google.cloud.storage.client.Client`
:param client: (Optional) The client to use.  If not passed, falls back
               to the ``client`` stored on the current bucket.

:rtype: dict
:returns: A dictionary of (form field name, form field value) of form
          fields that should be added to your HTML upload form in order
          to attach the signature.
N)tzinfor  )hoursr<   )
expirationrc   zutf-8)r<   GoogleAccessIdr  	signature)rR  _credentialsr	   ensure_signed_credentialsr   r   replacedatetime	timedeltar:   r   base64	b64encodejsondumpsencode
sign_bytessigner_emaildecode)	rW   rc   r  r   credentialspolicy_documentencoded_policy_documentr  rF  s	            r6   generate_upload_policyBucket.generate_upload_policy,  s	   4 %%f-))**;7d++4+88;M;MTU;VVJHdii#8"99
 /z:$

 #)"2"2JJ'..w7#
 $$[%;%;<S%TU	 ii)66-44W="))'2	
 r8   c           
         [        SS9   SU R                  ;  a  [        S5      eU R                  R                  S5      nUc  [        S5      eUR                  S5      (       a  [        S5      eU R	                  U5      nS	U R
                  0nU R                  b  U R                  US
'   SU R                   S3nUR                  USUUUU S9nU R                  U5        SSS5        g! , (       d  f       g= f)a#  Lock the bucket's retention policy.

:type client: :class:`~google.cloud.storage.client.Client` or
              ``NoneType``
:param client: (Optional) The client to use.  If not passed, falls back
               to the ``client`` stored on the blob's bucket.

:type timeout: float or tuple
:param timeout:
    (Optional) The amount of time, in seconds, to wait
    for the server response.  See: :ref:`configuring_timeouts`

:type retry: google.api_core.retry.Retry or google.cloud.storage.retry.ConditionalRetryPolicy
:param retry:
    (Optional) How to retry the RPC. See: :ref:`configuring_retries`

:raises ValueError:
    if the bucket has no metageneration (i.e., new or never reloaded);
    if the bucket has no retention policy assigned;
    if the bucket's retention policy is already locked.
z"Storage.Bucket.lockRetentionPolicyr   r=  z6Bucket has no retention policy assigned: try 'reload'?rG  NrM  z,Bucket's retention policy is already locked.ifMetagenerationMatchrG  rw  z/lockRetentionPolicyr  )
r   r   rT   r1   rR  r=  r  r:   r  r=   )rW   r   rO  rP  r  rM  r+  r  s           r6   lock_retention_policyBucket.lock_retention_policyb  s
   0 $HIt'7'77 L  %%))*;<F~ L  zz*%% !OPP))&1F3T5H5HIL  ,.2.?.?]+#78D!00)# 1 L   .A JIIs   CC))
C7c           
         Uc  SnOUS;  a  [        S5      eUc  U	(       a  U
(       a  [        S5      eUc  U R                  U5      nUR                  nU	(       a  [        X R                  5      nSnO$U
(       a  [        X5      nSnOSU R                   3nUc  U R                  U5      nUR                  nUS:X  a  [        nO[        nU" UUUUUR                  5       UUS9$ )a  Generates a signed URL for this bucket.

.. note::

    If you are on Google Compute Engine, you can't generate a signed
    URL using GCE service account. If you'd like to be able to generate
    a signed URL from GCE, you can use a standard service account from a
    JSON file rather than a GCE service account.

If you have a bucket that you want to allow access to for a set
amount of time, you can use this method to generate a URL that
is only valid within a certain time period.

If ``bucket_bound_hostname`` is set as an argument of :attr:`api_access_endpoint`,
``https`` works only if using a ``CDN``.

:type expiration: Union[Integer, datetime.datetime, datetime.timedelta]
:param expiration: Point in time when the signed URL should expire. If
                   a ``datetime`` instance is passed without an explicit
                   ``tzinfo`` set,  it will be assumed to be ``UTC``.

:type api_access_endpoint: str
:param api_access_endpoint: (Optional) URI base, for instance
    "https://storage.googleapis.com". If not specified, the client's
    api_endpoint will be used. Incompatible with bucket_bound_hostname.

:type method: str
:param method: The HTTP verb that will be used when requesting the URL.

:type headers: dict
:param headers:
    (Optional) Additional HTTP headers to be included as part of the
    signed URLs.  See:
    https://cloud.google.com/storage/docs/xml-api/reference-headers
    Requests using the signed URL *must* pass the specified header
    (name and value) with each request for the URL.

:type query_parameters: dict
:param query_parameters:
    (Optional) Additional query parameters to be included as part of the
    signed URLs.  See:
    https://cloud.google.com/storage/docs/xml-api/reference-headers#query

:type client: :class:`~google.cloud.storage.client.Client` or
              ``NoneType``
:param client: (Optional) The client to use.  If not passed, falls back
               to the ``client`` stored on the blob's bucket.

:type credentials: :class:`google.auth.credentials.Credentials` or
                   :class:`NoneType`
:param credentials: The authorization credentials to attach to requests.
                    These credentials identify this application to the service.
                    If none are specified, the client will attempt to ascertain
                    the credentials from the environment.

:type version: str
:param version: (Optional) The version of signed credential to create.
                Must be one of 'v2' | 'v4'.

:type virtual_hosted_style: bool
:param virtual_hosted_style:
    (Optional) If true, then construct the URL relative the bucket's
    virtual hostname, e.g., '<bucket-name>.storage.googleapis.com'.
    Incompatible with bucket_bound_hostname.

:type bucket_bound_hostname: str
:param bucket_bound_hostname:
    (Optional) If passed, then construct the URL relative to the bucket-bound hostname.
    Value can be a bare or with scheme, e.g., 'example.com' or 'http://example.com'.
    Incompatible with api_access_endpoint and virtual_hosted_style.
    See: https://cloud.google.com/storage/docs/request-endpoints#cname

:type scheme: str
:param scheme:
    (Optional) If ``bucket_bound_hostname`` is passed as a bare hostname, use
    this value as the scheme.  ``https`` will work only when using a CDN.
    Defaults to ``"http"``.

:raises: :exc:`ValueError` when version is invalid or mutually exclusive arguments are used.
:raises: :exc:`TypeError` when expiration is not a valid type.
:raises: :exc:`AttributeError` if credentials is not an instance
        of :class:`google.auth.credentials.Signing`.

:rtype: str
:returns: A signed URL you can use to access the resource
          until expiration.
v2)r  v4z%'version' must be either 'v2' or 'v4'zmThe bucket_bound_hostname argument is not compatible with either api_access_endpoint or virtual_hosted_style./)rk   r  api_access_endpointmethodrN  query_parameters)
rT   rR  api_endpointr   r:   r   r  r   r   upper)rW   r  r  r  rN  r  r   r  versionvirtual_hosted_stylebucket_bound_hostnamer)  rk   helpers                 r6   generate_signed_urlBucket.generate_signed_url  s   J ?GL(DEE  +/C#F 
 &))&1F"("5"5
  "@#YY# H""<%# H499+H))&1F --Kd?+F+F! 3<<>-
 	
r8   )r   r   r   r   r!  r   r  )NNNr  )NNNN) )NN)NNGETNNNNNFNhttp)rr   r   r   r   r   r  r%   r!   r   r   r   r#   r   STORAGE_CLASSESr    r$   r   _LOCATION_TYPESrV   r  r   r   r=   r  r   r  r   r  r   r#  r   r.  r3  r?   r(   rC  r   r)   rT  r^  r,   r2   rg  rm  rq  rt  staticmethodry  r+  r  r  r  r  r  r  r  r*   r  r  r  r  r  r   default_event_based_holdr  rj  r  r  r  r  r  r  r  r  r  r  r!  rY  r)  r-  r1  r7  r:  r=  r@  rD  rJ  rN  rS  rX  r   r_  rb  rg  rn  rt  r|  r  r  r  r  r  r  r  r+   r  r  r  r  r  r  r  r   r   r   s   @r6   r   r   j  sZ   & "% 	+%9O 	#!O
 48 (  : + + 	ZZ	+ 	+ " " 	# 	# 
@ 
@ 
@ 
@  
 ( (8 7 7< ,
` *
:   $$(Ur &* % IZ   $$(7+^   $$(ER   $$(74l   ( ( 	# 	# + +   $ $$( sn #' $(%M` #3=$R  $ P  $$( i\   $ $$( \B !   $ $$(@L   $ $$(#''+'++/ 3#Z@   $ $$(#''+'++/ 3Nh   $ $$(#''+'++/ 3z~   $ $$( 3gR V V8 
[[	. 	.  00GH : :   > !> % %: ]]? ?& 
, 
, 	* 	* : : 	< 	< * *X 
; 
;",%%"%$ !,I
 
 __ " < < 4 4"
#.. ' ' 	< 	< ' ' = = 
* 
* # # 8 8" 	0 	0 4 4. 4 4& 5 5 5 5 0 0 	E 	E 6 6  	H 	H / / 5 5 	= 	= ; ; &,,5 -5 	= 	= 	0 	0 
" 
" $**; +;..2 !% =.D  +7.t #'0@./d   $$(7`H   $$(7\B|4n #3=8/x  ""W
 W
r8   r   c                      ^  \ rS rSrSrU 4S jr\S 5       r\S 5       r	\S 5       r
\
R                  S 5       r
\S 5       rS	rU =r$ )
r  i6  aX  Map a bucket's soft delete policy.

See https://cloud.google.com/storage/docs/soft-delete

:type bucket: :class:`Bucket`
:param bucket: Bucket for which this instance is the policy.

:type retention_duration_seconds: int
:param retention_duration_seconds:
    (Optional) The period of time in seconds that soft-deleted objects in the bucket
    will be retained and cannot be permanently deleted.

:type effective_time: :class:`datetime.datetime`
:param effective_time:
    (Optional) When the bucket's soft delete policy is effective.
    This value should normally only be set by the back-end API.
c                    > 0 nUR                  S5      nXCS'   UR                  S5      nUb  [        U5      nXSS'   [        TU ]  U5        Xl        g )Nretention_duration_secondsretentionDurationSecondseffective_timerH  )r1   r   rU   rV   r   )rW   r<   r   r   r  r  rd   s         r6   rV   SoftDeletePolicy.__init__I  sZ    %'VV,H%I"+E'( 01%1.AN ._r8   c                 8    U " U5      nUR                  U5        U$ )a   Factory:  construct instance from resource.

:type resource: dict
:param resource: mapping as returned from API call.

:type bucket: :class:`Bucket`
:params bucket: Bucket for which this instance is the policy.

:rtype: :class:`SoftDeletePolicy`
:returns: Instance created from resource.
rh   r   s       r6   rB   SoftDeletePolicy.from_api_reprV  r   r8   c                     U R                   $ r   r   rq   s    r6   r<   SoftDeletePolicy.bucketg  r   r8   c                 B    U R                  S5      nUb  [        U5      $ g)a  Get the retention duration of the bucket's soft delete policy.

:rtype: int or ``NoneType``
:returns: The period of time in seconds that soft-deleted objects in the bucket
          will be retained and cannot be permanently deleted; Or ``None`` if the
          property is not set.
r  N)r1   r  )rW   durations     r6   r  +SoftDeletePolicy.retention_duration_secondsp  s(     8867x=   r8   c                 D    XS'   U R                   R                  SU 5        g)zSet the retention duration of the bucket's soft delete policy.

:type value: int
:param value:
    The period of time in seconds that soft-deleted objects in the bucket
    will be retained and cannot be permanently deleted.
r  r  Nr   r   s     r6   r  r  }  s"     ,1'(##$6=r8   c                 B    U R                  S5      nUb  [        U5      $ g)zGet the effective time of the bucket's soft delete policy.

:rtype: datetime.datetime or ``NoneType``
:returns: point-in time at which the bucket's soft delte policy is
          effective, or ``None`` if the property is not set.
rH  Nr   )rW   rI  s     r6   r  SoftDeletePolicy.effective_time  s(     HH_-	 -i88 !r8   r   )r   r   r   r   r   rV   r   rB   r   r<   r  r   r  r   r   r   s   @r6   r  r  6  sw    $      
! 
!  &&	> '	> 	9 	9r8   r  c                 |    UR                  5        H(  u  p#Uc  M
  [        U5      U :w  d  M  [        SU S35      e   g)ap  
Raise an error if any generation match argument
is set and its len differs from the given value.

:type expected_len: int
:param expected_len: Expected argument length in case it's set.

:type generation_match_args: dict
:param generation_match_args: Lists, which length must be checked.

:raises: :exc:`ValueError` if any argument set, but has an unexpected length.
N'z+' length must be the same as 'blobs' length)r  r  rT   )expected_lengeneration_match_argsr:   r   s       r6   r  r    s?     -224U|!;q&QRSS 5r8   )Pr   r  r  r  r  urllib.parser   r   google.api_corer   google.cloud._helpersr   r   google.cloud.exceptionsr   google.api_core.iamr   google.cloud.storager	   google.cloud.storage._helpersr
   r   r   r   r   r   r   google.cloud.storage._signingr   r   r   r   +google.cloud.storage._opentelemetry_tracingr   google.cloud.storage.aclr   r   google.cloud.storage.blobr   google.cloud.storage.constantsr   r   r   r   r   r   r    r!   r"   r#   r$   r%   !google.cloud.storage.notificationr'   r(   google.cloud.storage.retryr)   r*   r+   r,   r   r   r   r   r$  r1  r7   r@   rC   r   rE   r   r   r   objectr   r   r   r  r  r/   r8   r6   <module>r     sW   ;     !  , 6 < , & ) A J . 8 . : 8 @ @ D H I . 5 * ; @ A D O E A M H ? A @ A 4 L D P: 
K 
< 
M 
  L 
, .J(@>d @>F$ 64 D$ @ 8l<t l<^I3
^ I3
Xf]9t ]9@Tr8   