
    w/                        S r SSKJr  SSKJr  SSKJr  SSKJr  SSKJr  SSK	J
r
  SSKJr  SS	KJr  SS
KJr  SSKJr  SSKJr  \R&                  \R(                  " \R*                  R,                  5       " S S\R.                  5      5       5       r\R(                  " \R*                  R2                  \R*                  R4                  5      \R&                   " S S\5      5       5       rSSSSS.\l        g)z$Command to update snapshot settings.    )absolute_import)division)unicode_literals)base_classes)poller)waiter)base)flags)log)
properties)	resourcesc                   :    \ rS rSrSr\S 5       rS r SS jrSr	g)	Update    Update snapshot settings.c                 f    [         R                  " U 5        U R                  R                  S5        g )NzIyaml(storageLocation.policy, storageLocation.locations.list(show="keys")))r
   -AddUpdateSnapshotSettingsStorageLocationFlagsdisplay_info	AddFormatparsers    /lib/surface/compute/snapshot_settings/update.pyArgsUpdate.Args%   s)    	77?
!!	8    c                 $    U R                  U5      $ )N_Runselfargss     r   Run
Update.Run-   s    99T?r   c           
      0   [         R                  " U R                  5       5      nUR                  nU(       Ga  UR                  (       Ga  / nUR
                  R                  5       nUR                  (       ag  UR                   HW  nUR                  UR
                  R                  R                  R                  UUR
                  R                  US9S95        MY     UR                  (       ah  UR                   HX  nUR                  UR
                  R                  R                  R                  UUR
                  R                  5       S95        MZ     UR
                  R                  R                  US9Ul        UR                  (       aS  UR
                  R                  R                  UR                  R!                  5       R#                  SS5      5      nXl        UR&                  R(                  n	UR
                  R+                  UR
                  R-                  US9[.        R0                  R2                  R4                  R7                  5       UR                  SS9n
[8        R:                  R=                  S	R?                  [.        R0                  R2                  R4                  R7                  5       5      5        URA                  U	S
U
4/SS9S   n[B        RD                  RG                  URH                  [.        R0                  R2                  R4                  R7                  5       UR                  S.SS9nURJ                  (       a  [8        RL                  " USSSS9  U$ URB                  RG                  S [.        R0                  R2                  R4                  R6                  UR                  S.SS9n[N        RP                  " UR                  R&                  R(                  U5      n[R        RT                  " UUSR?                  [.        R0                  R2                  R4                  R7                  5       UR                  URW                  5       5      5        [8        R:                  R=                  SR?                  [.        R0                  R2                  R4                  R7                  5       5      5        UR&                  R(                  n	UR
                  RY                  [.        R0                  R2                  R4                  R7                  5       UR                  S9nURA                  U	SU4/SS9S   nU$ URZ                  (       a  SnOUR\                  (       a  SnO[_        S5      eUR
                  R-                  5       nURZ                  (       ak  UR
                  R`                  R                  URZ                  R!                  5       R#                  SS5      5      nUR
                  Ra                  US9Ul1        UR\                  (       a  [e        UR\                  5      S:w  a  [_        S5      eUR
                  R`                  R                  R                  UR\                  S   UR
                  Rg                  UR\                  S   S9S9/nURb                  c  UR
                  Ra                  5       Ul1        UR
                  R`                  R                  US9URb                  l        UR&                  Rh                  n	UR
                  Rk                  U[.        R0                  R2                  R4                  R7                  5       US9n
[8        R:                  R=                  S	R?                  [.        R0                  R2                  R4                  R7                  5       5      5        URA                  U	S
U
4/SS9S   n[B        RD                  RG                  URH                  S [.        R0                  R2                  R4                  R7                  5       0S!S9nURJ                  (       a  [8        RL                  " US"SS#S9  U$ URB                  RG                  S S [.        R0                  R2                  R4                  R6                  0S$S9n[N        RP                  " UR                  R&                  Rh                  U5      n[R        RT                  " UUS%R?                  [.        R0                  R2                  R4                  R7                  5       URW                  5       5      5        [8        R:                  R=                  SR?                  [.        R0                  R2                  R4                  R7                  5       5      5        UR&                  Rh                  n	UR
                  Rm                  [.        R0                  R2                  R4                  R7                  5       S&9nURA                  U	SU4/SS9S   nU$ )'N)region)keyvalue)additionalProperties-_)accessLocationr+   )snapshotSettingsprojectr%   
updateMaskzRequest issued for: [{0}]PatchT)no_followupr   )r-   r%   zcompute.regionOperations)params
collectionzgce regional snapshot settingszpUse [gcloud compute snapshot-settings describe --region={region}] command to check the status of this operation.)kindis_asyncdetailszcompute.regionSnapshotSettingszJWaiting for operation [projects/{0}/region/{1}/operations/{2}] to completezUpdated compute_project [{0}].GetstorageLocationzstorageLocation.locationsz4Must specify at least one valid parameter to update.)policy   zaInvalid value for [storage_location_names]: only a single location name is permitted at this time)name)r,   r-   r.   r-   zcompute.globalOperationszgce global snapshot settingsz^Use [gcloud compute snapshot-settings describe] command to check the status of this operation.zcompute.snapshotSettingszFWaiting for operation [projects/{0}/global/operations/{1}] to complete)r-   )7r   ComputeApiHolderReleaseTrackclientr%   messagesSnapshotSettingsAccessLocationadd_access_locationsappendLocationsValueAdditionalProperty6SnapshotSettingsAccessLocationAccessLocationPreferenceremove_access_locations	locationsaccess_location_policyPolicyValueValuesEnumupperreplacer8   apitools_clientregionSnapshotSettings)ComputeRegionSnapshotSettingsPatchRequestSnapshotSettingsr   VALUEScorer-   	GetOrFailr   statusPrintformatMakeRequestsr   REGISTRYParser:   async_UpdatedResourcer   Pollerr   WaitForName'ComputeRegionSnapshotSettingsGetRequeststorage_location_policystorage_location_names
ValueError'SnapshotSettingsStorageLocationSettingsr7   len@SnapshotSettingsStorageLocationSettingsStorageLocationPreferencer,   #ComputeSnapshotSettingsPatchRequest!ComputeSnapshotSettingsGetRequest)r    r!   support_regionholderr=   new_locations_valuesaccess_locationlocation
new_policyservicepatch_requestresultoperation_refsnap_settings_refoperation_pollerget_requestupdate_maskupdate_snapshot_settingss                     r   r   Update._Run0   s   
 **4+<+<+>?F]]F$+++  FFHo		"	"11H

%
%oo<<KK^^^^% _  _  2 
	%	%44H

%
%oo<<KK^^^^` _  5 //
8
8
G
G#7 H   
	$	$__CCYY''--/77SA

 ", &&==gooOO!??;;, <  ##((00::<% P m 
jj
%
,
,$$,,668 ""Wm,
-4 # 	f  ((..
++#**//77AAC 0 / m 
1		
  **00
#**//77AA 6 1   
--
'
'
>
>
 nn

f$$,,668kk  "		 
jj
*
1
1$$,,668 &&==gOOKK##((00::< L k ""UK(
)t # 	f m 
	%	%'&&1OPP!'!A!A!C		%	%__LLbb((..088cB

 OOCC! D  	!0 
	$	$t**+q09 
 OOCCRRee//2ooff44Q7 g  f  
 $33;ooEEG #
2 >D__=t=t  >D  >D!5 >D >
 00:
 &&77gooII3##((00::<  J m
 
jj
%
,
,$$,,668
 ""Wm,
-4 # 	f  ((..
++**//77AAC 0 / m 
/7	
  **00
**//77AA 0 1   
--
'
'
8
8
 nn

f$$,,668-:L:L:N	 
jj
*
1
1$$,,668 &&77gOOEE##((00::< F k ""UK(
)t # 	f mr    N)F)
__name__
__module____qualname____firstlineno____doc__staticmethodr   r"   r   __static_attributes__rv   r   r   r   r       s)     "  nr   r   c                   .    \ rS rSrSr\S 5       rS rSrg)UpdateAlphaAndBetai!  r   c                     [         R                  " U 5        [         R                  " U 5        [         R                  " U 5        U R                  R                  S5        g )Nzyaml(accessLocation.policy,accessLocation.locations.list(show="keys"),storageLocation.policy,storageLocation.locations.list(show="keys")))r
   ,AddUpdateSnapshotSettingsAccessLocationFlagsr   AddSnapshotSettingArgr   r   r   s    r   r   UpdateAlphaAndBeta.Args&  sE    	66v>	77?	'
!!	7r   c                 "    U R                  USS9$ )NT)rf   r   r   s     r   r"   UpdateAlphaAndBeta.Run1  s    99   r   rv   N)	rw   rx   ry   rz   r{   r|   r   r"   r}   rv   r   r   r   r   !  s     " r   r   r   z7      Update the snapshot settings of a project.
      a      To update the snapshot settings and set the storage location policy to the
    nearest multi-region as the source disk, run:

          $ {command} --storage-location-policy=nearest-multi-region

    To update the snapshot settings and set the storage location policy to the
    same region as the source disk, run:

          $ {command} --storage-location-policy=local-region

    To update the snapshot settings and set the storage location policy to
    store snapshots in a specific location like `us-west1`, run:

          $ {command} --storage-location-policy=specific-locations               --storage-location-names=us-west1
     z      This command uses the compute/alpha or compute/beta or compute/v1 API. The full documentation for this API
     can be found at: https://cloud.google.com/compute/)briefDESCRIPTIONEXAMPLESzAPI REFERENCEN)r{   
__future__r   r   r   googlecloudsdk.api_lib.computer   )googlecloudsdk.api_lib.compute.operationsr   googlecloudsdk.api_lib.utilr   googlecloudsdk.callioper	   4googlecloudsdk.command_lib.compute.snapshot_settingsr
   googlecloudsdk.corer   r   r   UniverseCompatibleReleaseTracksr<   GAUpdateCommandr   ALPHABETAr   detailed_helprv   r   r   <module>r      s     + &  ' 7 < . ( F # * ) D%%(()|T | * |~ D%%++T->->-C-CD   E, )
	";- r   