
    kC                        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 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$SAS  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+ r0S, r1S- r2S. r3S/ r4S0 r5S1 r6S2 r7S3 r8S4 r9S5 r:S6 r;S7 r<S8 r=S@S9 jr>S: r?S@S; jr@S@S< jrAS@S= jrBS> rCg?)Bz:Flags and helpers for general Cloud NetApp Files commands.    )absolute_import)division)unicode_literals)	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"   5   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(   :   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+   P   s'    0I0I		2	2I
' 'r   c                  0    [         R                  " SS5      $ )Nreplicationr$   r    r!   r   r   GetReplicationAttributeConfigr.   Y   s    		2	25
7 7r   c                  0    [         R                  " SS5      $ )N	operationzThe Cloud NetApp operation.r    r!   r   r   GetOperationAttributeConfigr1   ^   s    		2	20
2 2r   c                  0    [         R                  " SS5      $ )Nactive_directoryr   r    r!   r   r   !GetActiveDirectoryAttributeConfigr4   c   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   GetBackupVaultAttributeConfigr7   i   s<    ,	 ''(89:L		2	2;
 r   c                  0    [         R                  " SS5      $ )Nbackupr   r    r!   r   r   GetBackupAttributeConfigr:   u   s    		2	21
3 3r   c                  0    [         R                  " SS5      $ )Nbackup_policyr   r    r!   r   r   GetBackupPolicyAttributeConfigr=   z   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   GetKeyRingAttributeConfigrC      s    		2	23
 r   c                  0    [         R                  " SS5      $ )N
crypto_keyr   r    r!   r   r   GetCryptoKeyAttributeConfigrF          		2	25
 r   c                  0    [         R                  " SS5      $ )N
quota_ruler   r    r!   r   r   GetQuotaRuleAttributeConfigrJ      rG   r   c                  0    [         R                  " SS5      $ )N
host_groupr   r    r!   r   r   GetHostGroupAttributeConfigrM      rG   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   GetLocationResourceSpecrX      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   rO   )
r   r   insertr
   Fallthroughr	   rS   r   rT   rU   rV   s    r   GetListingLocationResourceSpecra      s^    8:((//		+,L	MO			$$::+	
- -r   c                      [         R                  " [        R                  S[         R                  [        5       [        5       S9$ )Nr0   )rP   rQ   rR   operationsId)r	   rS   r   OPERATIONS_COLLECTIONrU   r   r1   r!   r   r   GetOperationResourceSpecre      s6    			%%::,..0
2 2r   c                      [         R                  " [        R                  S[         R                  [        5       [        5       S9$ )Nr   )rP   rQ   rR   storagePoolsId)r	   rS   r   STORAGEPOOLS_COLLECTIONrU   r   r"   r!   r   r   GetStoragePoolResourceSpecri      s6    			''"::,.24
6 6r   c           
          [         R                  " [        R                  S[         R                  [        5       [        U S9S9$ )Nr%   r'   )rP   rQ   rR   	volumesId)r	   rS   r   VOLUMES_COLLECTIONrU   r   r(   rk   s    r   GetVolumeResourceSpecrn      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
Frk   r*   )rP   rQ   rR   rl   snapshotsId)r   r(   r   r
   r   r   r   r   r   r	   rS   r   SNAPSHOTS_COLLECTIONrU   r+   )source_snapshot_opr'   rW   volume_attribute_configs       r   GetSnapshotResourceSpecrt      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$ )NFrk   r-   )rP   api_versionrQ   rR   rl   replicationsId)	r   r(   r	   rS   r   REPLICATIONS_COLLECTIONBETA_API_VERSIONrU   r.   )rW   rs   s     r   GetReplicationResourceSpecrz      sS    8:4F			''!,,::+'24
6 6r   c                      [         R                  " [        R                  S[         R                  [        5       [        5       S9$ )Nr3   )rP   rQ   rR   activeDirectoriesId)r	   rS   r   ACTIVEDIRECTORIES_COLLECTIONrU   r   r4   r!   r   r   GetActiveDirectoryResourceSpecr~      s6    			,,&::,.;=
? ?r   c            	          [         R                  " [        R                  S[        R                  [         R
                  [        5       [        5       S9$ )Nr?   )rP   rv   rQ   rR   kmsConfigsId)r	   rS   r   KMSCONFIGS_COLLECTIONry   rU   r   r@   r!   r   r   GetKmsConfigResourceSpecr     s?    			%% ,,::,..0
2 2r   c                     [         R                  " [        R                  S[        R                  [         R
                  [        5       [        U S9S9$ )Nr6   rk   )rP   rv   rQ   rR   backupVaultsId)r	   rS   r   BACKUPVAULTS_COLLECTIONry   rU   r   r7   rk   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$ )NFrk   r9   )rP   rv   rQ   rR   r   	backupsId)r   r7   r
   r   r   r   r   r   r   r	   rS   r   BACKUPS_COLLECTIONry   rU   r:   )r'   rW   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$ )Nr<   )rP   rv   rQ   rR   backupPoliciesId)r	   rS   r   BACKUPPOLICIES_COLLECTIONry   rU   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.cryptoKeysrE   )rP   rQ   rR   
keyRingsIdcryptoKeysId)r	   rS   rU   r   rC   rF   r!   r   r   GetCryptoKeyResourceSpecr   9  s6    			7 ::,.*,.0
 r   c                      [         R                  " [        R                  S[        R                  [         R
                  [        5       [        SS9[        5       S9$ )NrI   Frk   )rP   rv   rQ   rR   rl   quotaRulesId)	r	   rS   r   QUOTA_RULES_COLLECTIONry   rU   r   r(   rJ   r!   r   r   GetQuotaRuleResourceSpecr   D  sG    			&& ,,::,.(E:.0
 r   c                      [         R                  " [        R                  S[         R                  [        5       [        5       S9$ )NrL   )rP   rQ   rR   hostGroupsId)r	   rS   r   HOST_GROUPS_COLLECTIONrU   r   rM   r!   r   r   GetHostGroupResourceSpecr   P  s6    			&& ::,..0
 r   c                 @    [         R                  " S[        5       U SS9$ )Nr   Trequired)r   ResourcePresentationSpecrX   
group_helps    r   GetLocationPresentationSpecr   \  s$    		4	4)+Z$
H Hr   c                 B    [         R                  " S[        5       U 5      $ )Nr   )r   r   ra   r   s    r   *GetResourceListingLocationPresentationSpecr   a  s!    		4	4$&
 r   c                 @    [         R                  " S[        5       U SS9$ )Nr0   Tr   )r   r   re   r   s    r   GetOperationPresentationSpecr   h  s$    		4	4+-zD
J Jr   c                 @    [         R                  " S[        5       U SS9$ )Nr   Tr   )r   r   ri   r   s    r   GetStoragePoolPresentationSpecr   m  s$    		4	402J
O Or   c                 @    [         R                  " S[        5       U SS9$ )Nr%   Tr   )r   r   rn   r   s    r   GetVolumePresentationSpecr   r  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   rt   r   s    r   GetSnapshotPresentationSpecr   w  s+    		4	4#R.
* *r   c                 F    [         R                  " S[        5       U SSS0S9$ )Nr-   Tr%   r   r   )r   r   rz   r   s    r   GetReplicationPresentationSpecr     s+    		4	4 "#R.
* *r   c                 @    [         R                  " S[        5       U SS9$ )Nr3   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$ )Nr6   Tr   )r   r   r   r   s    r   GetBackupVaultPresentationSpecr     s$    		4	4 "	
 r   c                 F    [         R                  " S[        5       U SSS0S9$ )Nr9   Tr6   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$ )NrI   Tr%   r   r   )r   r   r   r   s    r   GetQuotaRulePresentationSpecr     s+    		4	4 #R.
* *r   c                 @    [         R                  " S[        5       U SS9$ )NrL   Tr   )r   r   r   r   s    r   GetHostGroupPresentationSpecr     s$    		4	4 	
 r   c                 @    [         R                  " S[        5       U SS9$ )Nr<   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)parserrP   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   rP   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)D__doc__
__future__r   r   r   googlecloudsdk.api_lib.netappr   googlecloudsdk.callioper   r    googlecloudsdk.calliope.conceptsr	   r
   (googlecloudsdk.command_lib.util.conceptsr   googlecloudsdk.corer   r   r"   r(   r+   r.   r1   r4   r7   r:   r=   r@   rC   rF   rJ   rM   rX   ra   re   ri   rn   rt   rz   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      s1   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   