
    B                        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	 rS
 rS=S jrS=S jrS rS rS rS=S jrS rS rS rS rS rS rS rS rS rS rS rS=S jr S>S jr!S r"S r#S  r$S=S! jr%S=S" jr&S# r'S$ r(S% r)S& r*S' r+S( r,S) r-S* r.S+ r/S, r0S- r1S. r2S/ r3S0 r4S1 r5S2 r6S3 r7S4 r8S5 r9S=S6 jr:S7 r;S=S8 jr<S=S9 jr=S=S: jr>S; r?g<)?z:Flags and helpers for general Cloud NetApp Files commands.    )	constants)arg_parsers)base)concepts)deps)presentation_specs)
propertiesc                      [         R                  " S5      [         R                  " [        R                  R
                  R                  5      /n [        R                  " SU SS9$ )zoReturn the Location Attribute Config for resources.

Returns:
  ResourceParameterAttributeConfig for location.

--locationlocationzThe location of the {resource}.namefallthroughs	help_text)	r   ArgFallthroughPropertyFallthroughr	   VALUESnetappr   r    ResourceParameterAttributeConfigr   s    .lib/googlecloudsdk/command_lib/netapp/flags.pyGetLocationAttributeConfigr      sW     ,'
z0077@@A	, 
	2	21
3 3    c                  0    [         R                  " SS5      $ )Nstorage_poolThe instance of the {resource}.r   r    r   r   GetStoragePoolAttributeConfigr   2   s    		2	27
9 9r   c                     U (       a  / nO[         R                  " S5      /nU (       a  SOSn[        R                  " SXS9$ )zReturn the Volume Attribute Config for resources.

Args:
  positional: boolean value describing whether volume attribute is conditional

Returns:
  volume resource parameter attribute config for resource specs

z--volumeThe instance of the {resource}zThe volume of the {resource}volumer   r   r   r   r   )
positionalr   r   s      r   GetVolumeAttributeConfigr%   7   sI     L ''
34L3=/$ 		2	2,
E Er   c                 D    U (       a  SnOSn[         R                  " SUS9$ )Nr!   zThe snapshot of the {resource}snapshot)r   r   )r$   r   s     r   GetSnapshotAttributeConfigr(   M   s'    0I0I		2	2I
' 'r   c                  0    [         R                  " SS5      $ )Nreplicationr!   r   r   r   r   GetReplicationAttributeConfigr+   V   s    		2	25
7 7r   c                  0    [         R                  " SS5      $ )N	operationzThe Cloud NetApp operation.r   r   r   r   GetOperationAttributeConfigr.   [   s    		2	20
2 2r   c                  0    [         R                  " SS5      $ )Nactive_directoryr   r   r   r   r   !GetActiveDirectoryAttributeConfigr1   `   s    		2	2;
 r   c                 n    / nU (       d  [         R                  " S5      /n[        R                  " SSUS9$ )Nz--backup-vaultbackup_vaultz#The Backup Vault of the {resource}.r   r#   )r$   r   s     r   GetBackupVaultAttributeConfigr4   f   s<    ,	 ''(89:L		2	2;
 r   c                  0    [         R                  " SS5      $ )Nbackupr   r   r   r   r   GetBackupAttributeConfigr7   r   s    		2	21
3 3r   c                  0    [         R                  " SS5      $ )Nbackup_policyr   r   r   r   r   GetBackupPolicyAttributeConfigr:   w   s    		2	28
 r   c                  0    [         R                  " SS5      $ )N
kms_configr!   r   r   r   r   GetKmsConfigAttributeConfigr=   }   s    		2	24
6 6r   c                  0    [         R                  " SS5      $ )Nkey_ringr   r   r   r   r   GetKeyRingAttributeConfigr@      s    		2	23
 r   c                  0    [         R                  " SS5      $ )N
crypto_keyr   r   r   r   r   GetCryptoKeyAttributeConfigrC          		2	25
 r   c                  0    [         R                  " SS5      $ )N
quota_ruler   r   r   r   r   GetQuotaRuleAttributeConfigrG      rD   r   c                  0    [         R                  " SS5      $ )N
host_groupr   r   r   r   r   GetHostGroupAttributeConfigrJ      rD   r   c                      [        5       n / U l        [        R                  " [        R
                  S[        R                  U S9$ )Nr   resource_name
projectsIdlocationsId)r   r   r   ResourceSpecr   LOCATIONS_COLLECTION DEFAULT_PROJECT_ATTRIBUTE_CONFIGlocation_attribute_configs    r   GetLocationResourceSpecrU      s?    8:+-(			$$::+	
- -r   c                      [        5       n U R                  R                  S[        R                  " S SS95        [
        R                  " [        R                  S[
        R                  U S9$ )Nr   c                      g)N-r   r   r   r   <lambda>0GetListingLocationResourceSpec.<locals>.<lambda>   s    #r   zuses all locations by default.)hintr   rL   )
r   r   insertr   Fallthroughr   rP   r   rQ   rR   rS   s    r   GetListingLocationResourceSpecr^      s^    8:((//		+,L	MO			$$::+	
- -r   c                      [         R                  " [        R                  S[         R                  [        5       [        5       S9$ )Nr-   )rM   rN   rO   operationsId)r   rP   r   OPERATIONS_COLLECTIONrR   r   r.   r   r   r   GetOperationResourceSpecrb      s6    			%%::,..0
2 2r   c                      [         R                  " [        R                  S[         R                  [        5       [        5       S9$ )Nr   )rM   rN   rO   storagePoolsId)r   rP   r   STORAGEPOOLS_COLLECTIONrR   r   r   r   r   r   GetStoragePoolResourceSpecrf      s6    			''"::,.24
6 6r   c           
          [         R                  " [        R                  S[         R                  [        5       [        U S9S9$ )Nr"   r$   )rM   rN   rO   	volumesId)r   rP   r   VOLUMES_COLLECTIONrR   r   r%   rh   s    r   GetVolumeResourceSpecrk      s8    			""::,.(J?
 r   c                 F   [        5       n[        SS9nU (       a  / Ul        U(       d>  [        R                  " [
        R                  R                  R                  5      /Ul        [        R                  " [        R                  S[        R                  UU[        US9S9$ )zGets the Resource Spec for Snapshot.

Args:
  source_snapshot_op: Boolean on whether operation uses snapshot as source or
    not.
  positional: Boolean on whether resource is positional arg ornot

Returns:
  The Resource Spec for Snapshot
Frh   r'   )rM   rN   rO   ri   snapshotsId)r   r%   r   r   r   r	   r   r   r   r   rP   r   SNAPSHOTS_COLLECTIONrR   r(   )source_snapshot_opr$   rT   volume_attribute_configs       r   GetSnapshotResourceSpecrq      s     9:4F ,.(	  !2!2!9!9!B!BC.* 
		$$::+',
C
E Er   c            
          [        5       n [        SS9n[        R                  " [        R
                  S[        R                  [        R                  U U[        5       S9$ )NFrh   r*   )rM   api_versionrN   rO   ri   replicationsId)	r   r%   r   rP   r   REPLICATIONS_COLLECTIONBETA_API_VERSIONrR   r+   )rT   rp   s     r   GetReplicationResourceSpecrw      sS    8:4F			''!,,::+'24
6 6r   c                      [         R                  " [        R                  S[         R                  [        5       [        5       S9$ )Nr0   )rM   rN   rO   activeDirectoriesId)r   rP   r   ACTIVEDIRECTORIES_COLLECTIONrR   r   r1   r   r   r   GetActiveDirectoryResourceSpecr{      s6    			,,&::,.;=
? ?r   c            	          [         R                  " [        R                  S[        R                  [         R
                  [        5       [        5       S9$ )Nr<   )rM   rs   rN   rO   kmsConfigsId)r   rP   r   KMSCONFIGS_COLLECTIONrv   rR   r   r=   r   r   r   GetKmsConfigResourceSpecr     s?    			%% ,,::,..0
2 2r   c                     [         R                  " [        R                  S[        R                  [         R
                  [        5       [        U S9S9$ )Nr3   rh   )rM   rs   rN   rO   backupVaultsId)r   rP   r   BACKUPVAULTS_COLLECTIONrv   rR   r   r4   rh   s    r   GetBackupVaultResourceSpecr     sA    			''",,::,.2jI
 r   c           
      J   [        5       n[        SS9nU (       d>  [        R                  " [        R
                  R                  R                  5      /Ul        [        R                  " [        R                  S[        R                  [        R                  UU[        5       S9$ )NFrh   r6   )rM   rs   rN   rO   r   	backupsId)r   r4   r   r   r	   r   r   r   r   r   rP   r   BACKUPS_COLLECTIONrv   rR   r7   )r$   rT   backup_vault_attribute_configs      r   GetBackupResourceSpecr     s    8:"?# 
  !2!2!9!9!B!BC.* 
		"",,::+2(*
 r   c            	          [         R                  " [        R                  S[        R                  [         R
                  [        5       [        5       S9$ )Nr9   )rM   rs   rN   rO   backupPoliciesId)r   rP   r   BACKUPPOLICIES_COLLECTIONrv   rR   r   r:   r   r   r   GetBackupPolicyResourceSpecr   ,  s?    			))#,,::,.57
9 9r   c            	          [         R                  " SS[         R                  [        5       [	        5       [        5       S9$ )Nz/cloudkms.projects.locations.keyRings.cryptoKeysrB   )rM   rN   rO   
keyRingsIdcryptoKeysId)r   rP   rR   r   r@   rC   r   r   r   GetCryptoKeyResourceSpecr   6  s6    			7 ::,.*,.0
 r   c                      [         R                  " [        R                  S[        R                  [         R
                  [        5       [        SS9[        5       S9$ )NrF   Frh   )rM   rs   rN   rO   ri   quotaRulesId)	r   rP   r   QUOTA_RULES_COLLECTIONrv   rR   r   r%   rG   r   r   r   GetQuotaRuleResourceSpecr   A  sG    			&& ,,::,.(E:.0
 r   c                      [         R                  " [        R                  S[         R                  [        5       [        5       S9$ )NrI   )rM   rN   rO   hostGroupsId)r   rP   r   HOST_GROUPS_COLLECTIONrR   r   rJ   r   r   r   GetHostGroupResourceSpecr   M  s6    			&& ::,..0
 r   c                 @    [         R                  " S[        5       U SS9$ )Nr   Trequired)r   ResourcePresentationSpecrU   
group_helps    r   GetLocationPresentationSpecr   Y  s$    		4	4)+Z$
H Hr   c                 B    [         R                  " S[        5       U 5      $ )Nr   )r   r   r^   r   s    r   *GetResourceListingLocationPresentationSpecr   ^  s!    		4	4$&
 r   c                 @    [         R                  " S[        5       U SS9$ )Nr-   Tr   )r   r   rb   r   s    r   GetOperationPresentationSpecr   e  s$    		4	4+-zD
J Jr   c                 @    [         R                  " S[        5       U SS9$ )Nr   Tr   )r   r   rf   r   s    r   GetStoragePoolPresentationSpecr   j  s$    		4	402J
O Or   c                 @    [         R                  " S[        5       U SS9$ )Nr"   Tr   )r   r   rk   r   s    r   GetVolumePresentationSpecr   o  s$    		4	4%'d
D Dr   c                 F    [         R                  " S[        5       U SSS0S9$ )Nr'   Tr"    r   flag_name_overrides)r   r   rq   r   s    r   GetSnapshotPresentationSpecr   t  s+    		4	4#R.
* *r   c                 F    [         R                  " S[        5       U SSS0S9$ )Nr*   Tr"   r   r   )r   r   rw   r   s    r   GetReplicationPresentationSpecr   }  s+    		4	4 "#R.
* *r   c                 @    [         R                  " S[        5       U SS9$ )Nr0   Tr   )r   r   r{   r   s    r   "GetActiveDirectoryPresentationSpecr     s$    		4	4$&	
 r   c                 @    [         R                  " S[        5       U SS9$ )Nr<   Tr   )r   r   r   r   s    r   GetKmsConfigPresentationSpecr     s$    		4	4 	
 r   c                 @    [         R                  " S[        5       U SS9$ )Nr3   Tr   )r   r   r   r   s    r   GetBackupVaultPresentationSpecr     s$    		4	4 "	
 r   c                 F    [         R                  " S[        5       U SSS0S9$ )Nr6   Tr3   r   r   )r   r   r   r   s    r   GetBackupPresentationSpecr     s,    		4	4)2.
0 0r   c                 F    [         R                  " S[        5       U SSS0S9$ )NrF   Tr"   r   r   )r   r   r   r   s    r   GetQuotaRulePresentationSpecr     s+    		4	4 #R.
* *r   c                 @    [         R                  " S[        5       U SS9$ )NrI   Tr   )r   r   r   r   s    r   GetHostGroupPresentationSpecr     s$    		4	4 	
 r   c                 @    [         R                  " S[        5       U SS9$ )Nr9   Tr   )r   r   r   r   s    r   GetBackupPolicyPresentationSpecr     s$    		4	4!#	
 r   c                 D    U R                  SSSR                  U5      S9  g)zFAdd Description arg to arg_parser for a resource called resource_name.z--descriptionFz$A description of the Cloud NetApp {})r   helpN)add_argumentformat)parserrM   s     r   AddResourceDescriptionArgr     s*    188G  Ir   c                 p    U R                  S[        R                  " SSS/S9USR                  U5      S9  g)zCAdd Capacity arg to arg_parser for a resource called resource_name.z
--capacityGiBTiB)default_unitsuggested_binary_size_scaleszdThe desired capacity of the {} in GiB or TiB units.If no capacity unit is specified, GiB is assumed.typer   r   N)r   r   
BinarySizer   )r   rM   r   s      r   AddResourceCapacityArgr     sG    !!E5>K@@FA  !r   c                 p    Sn[         R                  " SUS9  [        R                  R	                  U 5        g )NzPReturn immediately, without waiting for the operation
  in progress to complete.async)r   r   )r   r   r   
ASYNC_FLAGAddToParser)r   r   s     r   AddResourceAsyncFlagr     s+    )
++IN//f%r   c                 0    U R                  S[        USS9  g)zAdds the Peer Cluster Name (--peer-cluster-name) arg to the given parser.

Args:
  parser: Argparse parser.
  required: Required to establish both cluster and svm peering.
z--peer-cluster-namezMName of the destination cluster to be peered
        with the source cluster.r   Nr   strr   r   s     r   AddResourcePeerClusterNameArgr     s%     	$	  r   c                 0    U R                  S[        USS9  g)zAdds the Peer SVM Name (--peer-svm-name) arg to the given parser.

Args:
  parser: Argparse parser.
  required: Required to establish both cluster and svm peering.
z--peer-svm-namezWName of the local source vserver svm to be peered
        with the destination cluster.r   Nr   r   s     r   AddResourcePeerSvmNameArgr     s%     	)	  r   c                 0    U R                  S[        USS9  g)zAdds the Peer Volume Name (--peer-volume-name) arg to the given parser.

Args:
  parser: Argparse parser.
  required: Required to establish both cluster and svm peering.
z--peer-volume-namezJName of the source volume to be peered
       with the destination volume.r   Nr   r   s     r   AddResourcePeerVolumeNameArgr      s%     	'	  r   c                 V    U R                  S[        R                  " S[        S9SSS9  g)zAdds the Peer IP Addresses (--peer-ip-addresses) arg to the given parser.

Args:
  parser: Argparse parser.

Not required for svm peering.
z--peer-ip-addresses   )
min_lengthelement_typePEER_IP_ADDRESSzpList of ip addresses to be used for peering. This is required for cluster peering, not required for svm peering.)r   metavarr   N)r   r   ArgListr   )r   s    r   AddResourcePeerIpAddressesArgr     s2     	!#><  r   N)T)FT)@__doc__googlecloudsdk.api_lib.netappr   googlecloudsdk.callioper   r    googlecloudsdk.calliope.conceptsr   r   (googlecloudsdk.command_lib.util.conceptsr   googlecloudsdk.corer	   r   r   r%   r(   r+   r.   r1   r4   r7   r:   r=   r@   rC   rG   rJ   rU   r^   rb   rf   rk   rq   rw   r{   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   <module>r      s(   A 4 / ( 5 1 G *
3&9
E,'7
2
	3
6
--26E>
6?2(9	H
J
O
D
**0*I	!&   r   