
    K              	       D   S 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  \R                   " SSS\R"                  SS9r\R                   " S\R&                  " S\R(                  SS9S\R"                  SS9r\R,                  " S\R.                  " SS5      R0                  R2                  SSSS.SSS9r\R                   " S S!S"SS#S$9r\\\S%.r\\S&.rS'rS( r \\\\ \RB                  " 5       \RB                  " 5       \RB                  " 5       S).r"/ S*Qr#S+r$\\\S,.r%S-S./r&SGS/ jr'SGS0 jr(SHS1 jr)    SIS2 jr*SJS3 jr+SGS4 jr,S5 r-SGS6 jr.S7 r/SGS8 jr0SGS9 jr1SHS: jr2 SKS; jr3 SKS< jr4S= r5S> r6S? r7S@ r8SA r9SB r:SC r;SD r<SE r=SF r>g)Lz Flags for data-catalog commands.    N)apis)arg_parsers)base)
exceptions)concepts)	arg_utils)	yaml_data)concept_parsers)presentation_specsz--filter
EXPRESSIONFaS      Apply a Boolean filter _EXPRESSION_ to each resource item to be listed.
    If the expression evaluates `True`, then that item is listed. For more
    details and examples of filter expressions, run $ gcloud topic filters. This
    flag interacts with other flags that are applied in this order: *--flatten*,
    *--filter*, *--limit*.)metavarrequire_coverage_in_testscategoryhelpz--limit   T)	unlimitedz    Maximum number of resources to list. The default is *unlimited*.
    This flag interacts with other flags that are applied in this order:
    *--flatten*, *--filter*, *--limit*.
    )typer   r   r   z--snapshot-auto-deletebaremetalsolutionv2)znewest-firstz!Delete the newest snapshot first.)zoldest-firstz!Delete the oldest snapshot first.)disabledzoDon't delete any snapshots. This disables new snapshot creation as long as the snapshot reserved space is full.)NEWEST_FIRSTOLDEST_FIRSTDISABLEDz:Behavior of the disk when snapshot reserved space is full.)arg_namemessage_enumcustom_mappingsrequiredhelp_strz--async
store_trueasync_zV    Return immediately, without waiting for the operation in progress to
    complete.)actiondestdefaultr   )start-addressend-addressnote)r$   r%   a  
Adds an allowed client to the NFS share. This flag can be repeated to specify multiple allowed clients.

*network*::: The name of the network to allow.

*network-project-id*::: The project ID of the allowed client network.
If not present, the project ID of the NFS share will be used.

*cidr*::: The subnet of IP addresses permitted to access the NFS
share.

*mount-permissions*::: The mount permissions for the allowed client.
``MOUNT_PERMISSIONS'' must be one of: `READ_ONLY`, `READ_WRITE`.

*allow-dev*::: If ``yes'', allows creation of devices.

*allow-suid*::: If ``yes'', allows SUID.

*enable-root-squash*::: If ``yes'', enables root squashing which
is a special mapping of the remote superuser (root) identity when
using identity authentication .
c                     U R                  5       nU[        ;  a&  [        R                  " SSR	                  U 5      5      eU$ )zCValidates NFS mount permissions field, throws exception if invalid.--allowed-clientz&Invalid value {} for mount-permissions)upperNFS_MOUNT_PERMISSIONS_CHOICESr   InvalidArgumentExceptionformat)mount_permissions_inputmount_permissionss     +lib/googlecloudsdk/command_lib/bms/flags.py_ValidateNFSMountPermissionsr0   s   sI    -335;;

-
-077#	%& & 
    )networknetwork-project-idcidrmount-permissions	allow-dev
allow-suidenable-root-squash)r2   r4   r5   r6   r7   r8   )	READ_ONLY
READ_WRITE)r2   r3   r4   r2   r4   c                 ,   U(       a  SnOSn[         R                  R                  S5      n[        R                  R                  UR                  5       5      n[        R                  " UUSSS9n[        R                  " U/5      R                  U 5      $ ).Sets up an argument for the instance resource.instancez
--instancezbms.instanceTz	instance.nameconcept_specr   
group_helpr	   ResourceYAMLDataFromPathr   ResourceSpecFromYamlGetDatar   ResourcePresentationSpecr
   ConceptParserAddToParser)parser
positionalr?   instance_dataresource_specpresentation_specs         r/   AddInstanceArgToParserrP          DD,,55-''001F1F1HI-(AA 	
 
	&	&(9':	;	G	G	OOr1   c                 ,   [         R                  R                  S5      n[        R                  R                  UR                  5       5      nU(       a  SnOSn[        R                  " UUSSS9n[        R                  " U/5      R                  U 5      $ )zParses region flag.z
bms.regionregionz--regionFzregion.r>   rB   )rK   rL   region_datarN   r?   rO   s         r/   AddRegionArgToParserrU      s    **33LA+''001D1D1FG-DD(AA 	
 
	&	&(9':	;	G	G	OOr1   c                 >   U(       a  SnOSn[         R                  R                  S5      n[        R                  R                  UR                  5       5      n[        R                  " UUSU=(       d    SS9n[        R                  " U/5      R                  U 5      $ )r<   volumez--volumez
bms.volumeTzvolume.r>   rB   )rK   rL   group_help_textr?   volume_datarN   rO   s          r/   AddVolumeArgToParserrZ      s    DD**33+''001D1D1FG-(AA  -I	/
 
	&	&(9':	;	G	G	OOr1   c           	      B   U(       d  U(       a  SnOSn[         R                  R                  S5      n[        R                  R                  UR                  5       5      n[        R                  " UUUUSS0SS9n[        R                  " U/5      R                  U 5      $ )z>Sets up an argument for the snapshot schedule policy resource.snapshot_schedule_policyz--snapshot-schedule-policyzbms.snapshot_schedule_policyrS    zsnapshot_schedule_policy.)r?   groupr@   r   flag_name_overridesrA   rB   )rK   rL   r   r?   r^   policy_datarN   rO   s           r/   $AddSnapshotSchedulePolicyArgToParserra      s     
'd)d**33$&+''001D1D1FG-(AA #R.,. 
	&	&(9':	;	G	G	OOr1   c           
          [         [        [         S.nU R                  SU[        R                  " U[        U5      UR                  5       S9SSSS9  g)	z,Sets up an argument for a snapshot schedule.)crontab_specretention_countprefixz
--schedule)spec
max_lengthrequired_keysappendz#CRONTAB_SPEC,RETENTION_COUNT,PREFIXaE  
              Adds a schedule for taking snapshots of volumes under this policy.
              This flag may be repeated to specify up to 5 schedules.

              *crontab_spec*::: Specification of the times at which snapshots
              will be taken. This should be in Crontab format:
              http://en.wikipedia.org/wiki/Cron#Overview

              *retention_count*::: The maximum number of snapshots to retain in
              this schedule.

              *prefix*::: Value to append to the name of snapshots created by
              this schedule.

           )r   r   r!   r   r   N)strintadd_argumentr   ArgDictlenkeys)rK   r   rf   s      r/   "AddSnapshotScheduleArgListToParserrp      s\     
$
 	D*-d)-1YY[: 3  r1   c                 ,   U(       a  SnOSn[         R                  R                  S5      n[        R                  R                  UR                  5       5      n[        R                  " UUSSS9n[        R                  " U/5      R                  U 5      $ )z-Sets up an argument for the network resource.r2   z	--networkzbms.networkTznetwork.r>   rB   )rK   rL   r?   r`   rN   rO   s         r/   AddNetworkArgToParserrr     s    DD**33+''001D1D1FG-(AA 	 
	&	&(9':	;	G	G	OOr1   c                    Sn[         R                  R                  S5      n[        R                  R                  UR                  5       5      n[        R                  " UUSSS9n[        R                  " U/5      R                  U 5      $ )1Sets up an argument for a volume snapshot policy.lunzbms.lunTzlun.r>   rB   )rK   r?   snapshot_datarN   rO   s        r/   AddLunArgToParserrw     s{    	$,,55i@-''001F1F1HI-(AA 	
 
	&	&(9':	;	G	G	OOr1   c                 ,   U(       a  SnOSn[         R                  R                  S5      n[        R                  R                  UR                  5       5      n[        R                  " UUSSS9n[        R                  " U/5      R                  U 5      $ )rt   snapshotz
--snapshotzbms.snapshotTz	snapshot.r>   rB   )rK   rL   r?   rv   rN   rO   s         r/   AddVolumeSnapshotArgToParserrz   %  s    DD,,55nE-''001F1F1HI-(AA 	
 
	&	&(9':	;	G	G	OOr1   c                 B    [         R                  R                  U 5        g)zDSets up an argument for a volume snapshot auto-delete-behavior enum.N)+VOLUME_SNAPSHOT_AUTO_DELETE_BEHAVIOR_MAPPER
choice_argrJ   rK   s    r/   .AddVolumeSnapshotAutoDeleteBehaviorArgToParserr   5  s    -88DDVLr1   c                 ,   U(       a  SnOSn[         R                  R                  S5      n[        R                  R                  UR                  5       5      n[        R                  " UUSSS9n[        R                  " U/5      R                  U 5      $ )z.Sets up an argument for an nfs-share resource.	nfs_sharez--nfs_sharezbms.nfs_shareTz
nfs_share.r>   rB   )rK   rL   r?   nfs_datarN   rO   s         r/   AddNfsShareArgToParserr   :  s    DD''00(''001A1A1CD-(AA 	
 
	&	&(9':	;	G	G	OOr1   c                 ,   U(       a  SnOSn[         R                  R                  S5      n[        R                  R                  UR                  5       5      n[        R                  " UUSSS9n[        R                  " U/5      R                  U 5      $ )z-Sets up an argument for an os-image resource.os_image
--os-imagezbms.os_imageTz	os_image.r>   rB   )rK   rL   r?   os_image_datarN   rO   s         r/   AddOsImageArgToParserr   K  rQ   r1   c                 0   U(       a  SOSn[         R                  R                  S5      n[        R                  R                  UR                  5       5      n[        R                  " UUSSS0SS9n[        R                  " U/5      R                  U 5      $ )	z<Sets up an argument for the serial-console-ssh-key resource.serial_console_ssh_keyz--serial-console-ssh-keyzbms.serial_console_ssh_keyTrS   r]   zserial_console_ssh_key.)r?   r@   r   r_   rA   rB   )rK   rL   r?   ssh_key_datarN   rO   s         r/   !AddSerialConsoleSshKeyArgToParserr   \  s    %/	!5O$++44", ''001E1E1GH-(AA #R.* 
	&	&(9':	;	G	G	OOr1   c                 R    U R                  US9n[        UUUUUS9  [        U5        g )Nr   )rL   r?   pluralr   )add_mutually_exclusive_groupAddSshKeyArgToParserAddClearSshKeyToParser)rK   rL   r?   r   r   group_parsers         r/    AddProvisioningSshKeyArgToParserr   m  s8     44h4G, &r1   c           	      J   U(       a  SOSn[         R                  R                  S5      n[        R                  R                  UR                  5       5      n[        R                  " U(       d  UOU S3UUSS0SUS9n[        R                  " U/5      R                  U 5      $ )	z-Sets up an argument for the ssh-key resource.ssh_keyz	--ssh-keyzbms.ssh_keysrS   r]   zssh_key.)r?   r@   r   r_   rA   r   rB   )rK   rL   r?   r   r   r   rN   rO   s           r/   r   r   {  s     !k$++44]C,''001E1E1GH-(AA4dV1: #R. 
	&	&(9':	;	G	G	OOr1   c                 (    U R                  SSSSS9  g )Nz--clear-ssh-keysr   z-Provisions the instance without any SSH keys.F)r!   r   r   )rl   r~   s    r/   r   r     s!    >	  r1   c                 J    U R                  S[        SR                  US9SS9  g )Nz
--new-namez8New {name} name for renaming an already existing {name}.)r?   T)r   r   r   )rl   rj   r,   )rK   obj_names     r/   AddNewNameArgToParserr     s5    IPP Q   r1   c                 2    U R                  S[        SUUS9  g )Nr   z
              OS image to install on the server.

              To list all OS image codes supported by BMS, run:

                  $ gcloud bms os-images list
        )r   r   hiddenr   rl   rj   )rK   r   r   s      r/   AddInstanceOsImageToParserr     s(       r1   c                 D    U R                  S[        R                  SUS9  g )Nz--enable-hyperthreadingz%Enable hyperthreading for the server.r!   r   r   )rl   r   StoreTrueFalseActionrK   r   s     r/   'AddInstanceEnableHyperthreadingToParserr     s'    --6	  r1   c                     U R                  SS9nUR                  S[        R                  " [        S9SSUS9  UR                  S[        R                  " [
        S9SS	US9  UR                  S
SSUS9  g)z:Adds the flags for network IP range reservation to parser.Fr   z--add-ip-range-reservation)rf   PROPERTY=VALUEau  
              Add a reservation of a range of IP addresses in the network.

              *start_address*::: The first address of this reservation block.
              Must be specified as a single IPv4 address, e.g. `10.1.2.2`.

              *end_address*::: The last address of this reservation block,
              inclusive. I.e., for cases when reservations are only single
              addresses, end_address and start_address will be the same.
              Must be specified as a single IPv4 address, e.g. `10.1.2.2`.

              *note*::: A note about this reservation, intended for human consumption.
            )r   r   r   r   z--remove-ip-range-reservationa  
              Remove a reservation of a range of IP addresses in the network.

              *start_address*::: The first address of the reservation block to remove.

              *end_address*::: The last address of the reservation block to remove.
            z--clear-ip-range-reservationsr   1Removes all IP range reservations in the network.r   N)r   rl   r   rm   IP_RESERVATION_SPECIP_RESERVATION_KEY_SPECrK   r   	group_args      r/   AddNetworkIpReservationToParserr     s    1151A)"$78 #  $ %$;<    %B	  r1   c                 0    U R                  SS[        SS9  g)zAdds size GiB argument for NFS.z
--size-gibz*The requested size of the NFS share in GiBT)r   r   r   N)rl   rk   r~   s    r/   AddNfsSizeGibArgr     s!    7	  r1   c                 L    U R                  SSSS.S[        R                  SS9  g)	z#Adds storage type argument for NFS.z--storage-typez5The storage type of the underlying volume will be SSDz5The storage type of the underlying volume will be HDD)SSDHDDTz\Specifies the storage type of the underlying volume which will be created for the NFS share.)choicesr   r   r   N)rl   r   ChoiceToEnumNamer~   s    r/   AddNfsStorageTypeArgr     s9     FE	 %%*  ,r1   c           	      j    U R                  S[        R                  " [        [        S9SSS[
        S9  g )Nr(   rf   rh   Tri   r   )r   r   r!   r   r   )rl   r   rm   NFS_ALLOWED_CLIENT_SPEC REQUIRED_NFS_ALLOWED_CLIENT_KEYSNFS_ALLOWED_CLIENTS_HELP_TEXTr~   s    r/   AddNfsAllowedClientArgr     s:    $;-M! (  	r1   c                    U R                  SUS9nUR                  S[        R                  " [        [
        S9SS[        S9  UR                  S[        R                  " [        [        S9SSS	S9  UR                  S
SSS9  g)z0Adds NFS update allowed clients arguments group.F)r   r   z--add-allowed-clientr   ri   r   )r   r!   r   r   z--remove-allowed-clienta  
              Removes an allowed client for the NFS share given its network name and cidr. This flag can be repeated to remove multiple allowed clients.

              *network*::: The name of the network of the allowed client to remove.

              *network-project-id*::: The project ID of the allowed client network.
              If not present, the project ID of the NFS share will be used.

              *cidr*::: The subnet of permitted IP addresses of the allowed client to remove.
            z--clear-allowed-clientsr   r   )r!   r   N)	r   rl   r   rm   r   r   r   REMOVE_NFS_ALLOWED_CLIENT_SPEC'REQUIRED_REMOVE_NFS_ALLOWED_CLIENT_KEYSr   s      r/   AddNfsUpdateAllowedClientArgsr     s    1151P)&8 (  	 -? 	  $ B  Dr1   c                 0    U R                  S[        SUS9  g )Nz--kms-crypto-key-versionz
      Resource ID of a KMS CryptoKeyVersion used to encrypt the initial password.

      https://cloud.google.com/kms/docs/resource-hierarchy#key_versions
      )r   r   r   r   r   s     r/   AddKMSCryptoKeyVersionToParserr   *  s%     

   	r1   )F)FN)FTNN)T)FNTF)?__doc__sysgooglecloudsdk.api_lib.utilr   googlecloudsdk.callioper   r   r    googlecloudsdk.calliope.conceptsr   $googlecloudsdk.command_lib.util.apisr   r	   (googlecloudsdk.command_lib.util.conceptsr
   r   ArgumentLIST_COMMAND_FLAGSFILTER_FLAG_NO_SORTBY_DOC
BoundedIntmaxsizeLIMIT_FLAG_NO_SORTBY_DOCChoiceEnumMapperGetMessagesModuleVolume)SnapshotAutoDeleteBehaviorValueValuesEnumr|   ASYNC_FLAG_DEFAULT_TRUErj   r   r   r   r0   
ArgBooleanr   r   r*   r   r   rP   rU   rZ   ra   rp   rr   rw   rz   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r    r1   r/   <module>r      s;   '  , / ( . 5 : : D G MM#$$

   ==			3;;$	?#$$
		  /8.H.H%''f>>MMG I/K +  --	
     
! 0 5'')((*%002 $   !< "  
+ 'P"P P$ 5:26.2/3	P0BP$
PP M
P"P"P$ @E' @EP$ %P, 
"DJ
r1   