
    C                        d Z ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlm	Z	 ddl
mZ dd	l
mZ dd
lmZ ddlmZ d Zd Zd@dZd@dZd Zd Zd Zd@dZd Zd Zd Zd Zd Zd Zd Zd Z d Z!d Z"d Z#d@dZ$dAd Z%d! Z&d" Z'd# Z(d@d$Z)d@d%Z*d& Z+d' Z,d( Z-d) Z.d* Z/d+ Z0d, Z1d- Z2d. Z3d/ Z4d0 Z5d1 Z6d2 Z7d3 Z8d4 Z9d5 Z:d6 Z;d7 Z<d8 Z=d@d9Z>d: Z?d@d;Z@d@d<ZAd@d=ZBd> ZCy?)Bz:Flags and helpers for general Cloud NetApp Files commands.    )absolute_import)division)unicode_literals)	constants)arg_parsers)base)concepts)deps)presentation_specs)
propertiesc                      t        j                  d      t        j                  t        j                  j
                  j                        g} t        j                  d| d      S )zuReturn 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                  .    t        j                  dd      S )Nstorage_poolThe instance of the {resource}.r	   r    r   r   GetStoragePoolAttributeConfigr"   5   s    		2	27
9 9r   c                 t    | rg }nt        j                  d      g}| rdnd}t        j                  d||      S )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(   :   sK     L ''
34L3=/$ 		2	2,)
E Er   c                 >    | rd}nd}t        j                  d|      S )Nr$   zThe snapshot of the {resource}snapshot)r   r    )r'   r   s     r   GetSnapshotAttributeConfigr+   P   s'    0I0I		2	2I
' 'r   c                  .    t        j                  dd      S )Nreplicationr$   r    r!   r   r   GetReplicationAttributeConfigr.   Y   s    		2	25
7 7r   c                  .    t        j                  dd      S )N	operationzThe Cloud NetApp operation.r    r!   r   r   GetOperationAttributeConfigr1   ^   s    		2	20
2 2r   c                  .    t        j                  dd      S )Nactive_directoryr   r    r!   r   r   !GetActiveDirectoryAttributeConfigr4   c   s    		2	2;
 r   c                 f    g }| st        j                  d      g}t        j                  dd|      S )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                  .    t        j                  dd      S )Nbackupr   r    r!   r   r   GetBackupAttributeConfigr:   u   s    		2	21
3 3r   c                  .    t        j                  dd      S )Nbackup_policyr   r    r!   r   r   GetBackupPolicyAttributeConfigr=   z   s    		2	28
 r   c                  .    t        j                  dd      S )N
kms_configr$   r    r!   r   r   GetKmsConfigAttributeConfigr@      s    		2	24
6 6r   c                  .    t        j                  dd      S )Nkey_ringr   r    r!   r   r   GetKeyRingAttributeConfigrC      s    		2	23
 r   c                  .    t        j                  dd      S )N
crypto_keyr   r    r!   r   r   GetCryptoKeyAttributeConfigrF          		2	25
 r   c                  .    t        j                  dd      S )N
quota_ruler   r    r!   r   r   GetQuotaRuleAttributeConfigrJ      rG   r   c                  .    t        j                  dd      S )N
host_groupr   r    r!   r   r   GetHostGroupAttributeConfigrM      rG   r   c                      t               } g | _        t        j                  t        j
                  dt        j                  |       S )Nr   resource_name
projectsIdlocationsId)r   r   r	   ResourceSpecr   LOCATIONS_COLLECTION DEFAULT_PROJECT_ATTRIBUTE_CONFIGlocation_attribute_configs    r   GetLocationResourceSpecrX      s?    8:+-(			$$::+	
- -r   c                      t               } | j                  j                  dt        j                  d d             t        j                  t        j                  dt
        j                  |       S )Nr   c                       y)N-r!   r!   r   r   <lambda>z0GetListingLocationResourceSpec.<locals>.<lambda>   s    #r   zuses all locations by default.)hintr   rO   )
r   r   insertr
   Fallthroughr	   rS   r   rT   rU   rV   s    r   GetListingLocationResourceSpecr`      s^    8:((//		+,L	MO			$$::+	
- -r   c                      t        j                  t        j                  dt         j                  t               t                     S )Nr0   )rP   rQ   rR   operationsId)r	   rS   r   OPERATIONS_COLLECTIONrU   r   r1   r!   r   r   GetOperationResourceSpecrd      s6    			%%::,..0
2 2r   c                      t        j                  t        j                  dt         j                  t               t                     S )Nr   )rP   rQ   rR   storagePoolsId)r	   rS   r   STORAGEPOOLS_COLLECTIONrU   r   r"   r!   r   r   GetStoragePoolResourceSpecrh      s6    			''"::,.24
6 6r   c           	          t        j                  t        j                  dt         j                  t               t        |             S )Nr%   r'   )rP   rQ   rR   	volumesId)r	   rS   r   VOLUMES_COLLECTIONrU   r   r(   rj   s    r   GetVolumeResourceSpecrm      s8    			""::,.(J?
 r   c           
      @   t               }t        d      }| rg |_        |s=t        j                  t
        j                  j                  j                        g|_        t        j                  t        j                  dt        j                  ||t        |            S )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
  Frj   r*   )rP   rQ   rR   rk   snapshotsId)r   r(   r   r
   r   r   r   r   r   r	   rS   r   SNAPSHOTS_COLLECTIONrU   r+   )source_snapshot_opr'   rW   volume_attribute_configs       r   GetSnapshotResourceSpecrs      s     9:4F ,.(	  !2!2!9!9!B!BC.* 
		$$::+',
C
E Er   c            
          t               } t        d      }t        j                  t        j
                  dt        j                  t        j                  | |t                     S )NFrj   r-   )rP   api_versionrQ   rR   rk   replicationsId)	r   r(   r	   rS   r   REPLICATIONS_COLLECTIONBETA_API_VERSIONrU   r.   )rW   rr   s     r   GetReplicationResourceSpecry      sS    8:4F			''!,,::+'24
6 6r   c                      t        j                  t        j                  dt         j                  t               t                     S )Nr3   )rP   rQ   rR   activeDirectoriesId)r	   rS   r   ACTIVEDIRECTORIES_COLLECTIONrU   r   r4   r!   r   r   GetActiveDirectoryResourceSpecr}      s6    			,,&::,.;=
? ?r   c            	          t        j                  t        j                  dt        j                  t         j
                  t               t                     S )Nr?   )rP   ru   rQ   rR   kmsConfigsId)r	   rS   r   KMSCONFIGS_COLLECTIONrx   rU   r   r@   r!   r   r   GetKmsConfigResourceSpecr     s?    			%% ,,::,..0
2 2r   c           
          t        j                  t        j                  dt        j                  t         j
                  t               t        |             S )Nr6   rj   )rP   ru   rQ   rR   backupVaultsId)r	   rS   r   BACKUPVAULTS_COLLECTIONrx   rU   r   r7   rj   s    r   GetBackupVaultResourceSpecr     sA    			''",,::,.2jI
 r   c           
      H   t               }t        d      }| s=t        j                  t        j
                  j                  j                        g|_        t        j                  t        j                  dt        j                  t        j                  ||t                     S )NFrj   r9   )rP   ru   rQ   rR   r   	backupsId)r   r7   r
   r   r   r   r   r   r   r	   rS   r   BACKUPS_COLLECTIONrx   rU   r:   )r'   rW   backup_vault_attribute_configs      r   GetBackupResourceSpecr     s    8:"?# 
  !2!2!9!9!B!BC.* 
		"",,::+2(*
 r   c            	          t        j                  t        j                  dt        j                  t         j
                  t               t                     S )Nr<   )rP   ru   rQ   rR   backupPoliciesId)r	   rS   r   BACKUPPOLICIES_COLLECTIONrx   rU   r   r=   r!   r   r   GetBackupPolicyResourceSpecr   /  s?    			))#,,::,.57
9 9r   c            	          t        j                  ddt         j                  t               t	               t                     S )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            
          t        j                  t        j                  dt        j                  t         j
                  t               t        d      t                     S )NrI   Frj   )rP   ru   rQ   rR   rk   quotaRulesId)	r	   rS   r   QUOTA_RULES_COLLECTIONrx   rU   r   r(   rJ   r!   r   r   GetQuotaRuleResourceSpecr   D  sG    			&& ,,::,.(E:.0
 r   c            	          t        j                  t        j                  dt        j                  t         j
                  t               t                     S )NrL   )rP   ru   rQ   rR   hostGroupsId)r	   rS   r   HOST_GROUPS_COLLECTIONrx   rU   r   rM   r!   r   r   GetHostGroupResourceSpecr   P  s?    			&& ,,::,..0
 r   c                 D    t        j                  dt               | d      S )Nr   Trequired)r   ResourcePresentationSpecrX   
group_helps    r   GetLocationPresentationSpecr   ]  s$    		4	4)+Z$
H Hr   c                 @    t        j                  dt               |       S )Nr   )r   r   r`   r   s    r   *GetResourceListingLocationPresentationSpecr   b  s!    		4	4$&
 r   c                 D    t        j                  dt               | d      S )Nr0   Tr   )r   r   rd   r   s    r   GetOperationPresentationSpecr   i  s$    		4	4+-zD
J Jr   c                 D    t        j                  dt               | d      S )Nr   Tr   )r   r   rh   r   s    r   GetStoragePoolPresentationSpecr   n  s$    		4	402J
O Or   c                 D    t        j                  dt               | d      S )Nr%   Tr   )r   r   rm   r   s    r   GetVolumePresentationSpecr   s  s$    		4	4%'d
D Dr   c                 J    t        j                  dt               | dddi      S )Nr*   Tr%    r   flag_name_overrides)r   r   rs   r   s    r   GetSnapshotPresentationSpecr   x  s+    		4	4#R.
* *r   c                 J    t        j                  dt               | dddi      S )Nr-   Tr%   r   r   )r   r   ry   r   s    r   GetReplicationPresentationSpecr     s+    		4	4 "#R.
* *r   c                 D    t        j                  dt               | d      S )Nr3   Tr   )r   r   r}   r   s    r   "GetActiveDirectoryPresentationSpecr     s$    		4	4$&	
 r   c                 D    t        j                  dt               | d      S )Nr?   Tr   )r   r   r   r   s    r   GetKmsConfigPresentationSpecr     s$    		4	4 	
 r   c                 D    t        j                  dt               | d      S )Nr6   Tr   )r   r   r   r   s    r   GetBackupVaultPresentationSpecr     s$    		4	4 "	
 r   c                 J    t        j                  dt               | dddi      S )Nr9   Tr6   r   r   )r   r   r   r   s    r   GetBackupPresentationSpecr     s,    		4	4)2.
0 0r   c                 J    t        j                  dt               | dddi      S )NrI   Tr%   r   r   )r   r   r   r   s    r   GetQuotaRulePresentationSpecr     s+    		4	4 #R.
* *r   c                 D    t        j                  dt               | d      S )NrL   Tr   )r   r   r   r   s    r   GetHostGroupPresentationSpecr     s$    		4	4 	
 r   c                 D    t        j                  dt               | d      S )Nr<   Tr   )r   r   r   r   s    r   GetBackupPolicyPresentationSpecr     s$    		4	4!#	
 r   c                 J    | j                  dddj                  |             y)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                 z    | j                  dt        j                  dddg      |dj                  |             y)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                 t    d}t        j                  d|       t        j                  j	                  |        y )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                 6    | j                  dt        |d       y)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                 6    | j                  dt        |d       y)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                 6    | j                  dt        |d       y)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                 `    | j                  dt        j                  dt              dd       y)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   r`   rd   rh   rm   rs   ry   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   