
                            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
 Ze	j$                   e	j&                  e	j(                  j*                         G d de	j,                                      Z e	j&                  e	j(                  j0                         G d de             Z e	j&                  e	j(                  j4                         G d de             Zy)Create a Cloud NetApp Volume.    )absolute_import)division)unicode_literals)client)base)flags)labels_util)logc                 2    t        j                  | |       y )N)release_track)volumes_flagsAddVolumeCreateArgs)parserr   s     $lib/surface/netapp/volumes/create.py_CommonArgsr      s    ##F-H    c                   \    e Zd ZdZej
                  j                  ZdddZe	d        Z
d Zy)Creater   z1          Create a Cloud NetApp Volume
          a            The following command creates a NFS Volume named NAME asynchronously using the specified arguments

              $ {command} NAME --capacity=1024 --protocols=nfsv3,nfsv4 --share-name=share1 --storage-pool=sp1 --description="test description" --enable-kerberos=true --unix-permissions=0755 --async

          The following command creates a SMB Volume named NAME asynchronously using the specified arguments

              $ {command} NAME --capacity=1024 --protocols=smb --share-name=share2 --storage-pool=sp2 --description="test smb" --security-style=ntfs --smb-settings=SHOW_SNAPSHOT,SHOW_PREVIOUS_VERSIONS,ACCESS_BASED_ENUMERATION --snap-reserve=0.1 --async
          )DESCRIPTIONEXAMPLESc                 8    t        | t        j                         y N)r   r   _RELEASE_TRACKr   s    r   ArgszCreate.Args7   s    --.r   c                    |j                   j                  j                         }t        j                  | j
                        }g }|j                  D ]3  }t        j                  ||j                        }|j                  |       5 |j                  dz	  }g }|j                  rB|j                  D ]3  }	t        j                  |	|j                        }
|j                  |
       5 i }|j                  |j                  |j                   |j"                  dj%                         D ]  \  }}|s	|||<    |sd}t        j&                  |j(                  |j                        }g }|j*                  rB|j*                  D ]3  }t        j,                  ||j                        }|j                  |       5 t/        j0                  ||j                  j2                  j4                        }|j6                  }|j8                  }|j:                  }|j<                  }g }| j
                  t>        j@                  jB                  k(  s'| j
                  t>        j@                  jD                  k(  r|jF                  }| j
                  t>        j@                  jD                  k(  s'| j
                  t>        j@                  jH                  k(  r|jJ                  }|jL                  }nd}d}|jO                  |jQ                         ||jR                  ||jT                  ||jV                  |jX                  |jZ                  |||j\                  |j^                  ||j`                  |jb                  ||||||jd                  |jf                  |||      }|ji                  ||jj                  |      }|jj                  rWdjm                  | jA                         jn                        }tp        jr                  ju                  djm                  |             |S )z4Create a Cloud NetApp Volume in the current project.   )hourly_snapshotdaily_snapshotweekly_snapshotmonthly_snapshotN)namecapacitydescriptionlabelsstorage_pool	protocols
share_nameexport_policyunix_permissionssmb_settingssnapshot_policysnap_reservesnapshot_directorysecurity_styleenable_kerberossnapshotbackuprestricted_actionsbackup_configlarge_capacitymultiple_endpointstiering_policyhybrid_replication_parametersthroughput_mibpscache_parametersblock_deviceszgcloud {} netapp volumes listzBCheck the status of the new volume by listing all volumes:
  $ {} );CONCEPTSvolumeParsevolumes_clientVolumesClientr   r(   r   GetVolumeProtocolEnumFromArgmessagesappendr$   r,   GetVolumeSmbSettingsEnumFromArgsnapshot_hourlysnapshot_dailysnapshot_weeklysnapshot_monthlyitems!GetVolumeSecurityStyleEnumFromArgr0   r4   %GetVolumeRestrictedActionsEnumFromArgr
   ParseCreateArgsVolumeLabelsValuer6   r:   r7   r;   r   ReleaseTrackALPHABETAr<   GAr5   source_backupParseVolumeConfigRelativeNamer%   r'   r)   r*   r+   r.   r/   r1   source_snapshotr8   r9   CreateVolumeasync_formatprefixr   statusPrint)selfargs
volume_refr   r(   protocolprotocol_enumcapacity_in_gibr,   smb_settingsmb_setting_enumr-   r#   snapshot_scheduler0   r4   restricted_actionrestricted_action_enumr&   r6   r:   r7   r;   r<   r5   rT   r>   resultcommands                                r   Runz
Create.Run;   s   %%++-J))$*=*=>FINN#@@
FOO%m}% # mmr)OL**+99V__. 	 	,-	 +
 O//--// 11	$
 eg$ 
 1$  o"DDV__N #66
??!6?? 	
 	!!"89  7 ((foo$$00F ((N,,00,,Mt00666$"3"3"8"88((mt00555t00333((m((mmm%%$$& $$&&??((..!'&&22%,,%%-#%-**&*&H&H))#5 & F8   T[[&AF{{/66




$
$&g	jj&/# Mr   N)__name__
__module____qualname____doc__r   rP   rS   r   detailed_helpstaticmethodr   rk    r   r   r   r   !   sC     &$$''.	- / /cr   r   c                   L    e Zd ZdZej
                  j                  Zed        Z	y)
CreateBetar   c                 8    t        | t        j                         y r   )r   rt   r   r   s    r   r   zCreateBeta.Args   s    
112r   N)
rl   rm   rn   ro   r   rP   rR   r   rq   r   rr   r   r   rt   rt      s(    %$$)).3 3r   rt   c                   L    e Zd ZdZej
                  j                  Zed        Z	y)CreateAlphar   c                 8    t        | t        j                         y r   )r   rw   r   r   s    r   r   zCreateAlpha.Args   s    223r   N)
rl   rm   rn   ro   r   rP   rQ   r   rq   r   rr   r   r   rw   rw      s(    %$$**.4 4r   rw   N)ro   
__future__r   r   r   %googlecloudsdk.api_lib.netapp.volumesr   r@   googlecloudsdk.callioper   )googlecloudsdk.command_lib.netapp.volumesr	   r   $googlecloudsdk.command_lib.util.argsr
   googlecloudsdk.corer   r   DefaultUniverseOnlyReleaseTracksrP   rS   CreateCommandr   rR   rt   rQ   rw   rr   r   r   <module>r      s    $ &  ' K ( L < #I D%%((){T { * {| D%%**+3 3 ,3 D%%++,4* 4 -4r   