
                            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dlmZ ej&                  Zej(                  Z G d de      Z G d de      Z G d de      Z G d de      Zy)zICommands for interacting with the Cloud NetApp Files Volume API resource.    )absolute_import)division)unicode_literals)
list_pager)	constants)util)waiter)base)log)	resources)netapp_v1beta1_messagesc            	       >   e Zd ZdZej
                  j                  fdZed        Z	ed        Z
d ZddZd Z	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 dd	Zd
 Zd Zd Zd Zd Z	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 ddZd Z	 ddedededefdZdededefdZy)VolumesClientzFWrapper for working with volumes in the Cloud NetApp Files API Client.c                    || _         | j                   t        j                  j                  k(  rt	               | _        y | j                   t        j                  j                  k(  rt               | _        y | j                   t        j                  j                  k(  rt               | _        y t        dj                  t        j                  |               )Nz [{}] is not a valid API version.)release_trackr
   ReleaseTrackALPHAAlphaVolumesAdapter_adapterBETABetaVolumesAdapterGAVolumesAdapter
ValueErrorformatr   VERSION_MAP)selfr   s     3lib/googlecloudsdk/api_lib/netapp/volumes/client.py__init__zVolumesClient.__init__(   s    &DT..444)+dm			t0055	5(*dm			t0033	3$&dm
,
3
3}-     c                 .    | j                   j                  S N)r   clientr   s    r   r#   zVolumesClient.client7   s    ==r    c                 .    | j                   j                  S r"   )r   messagesr$   s    r   r&   zVolumesClient.messages;   s    ==!!!r    c                     t        j                  t        j                  | j                  j                        |dj                  |j                                     S )a  Waits on the long-running operation until the done field is True.

    Args:
      operation_ref: the operation reference.

    Raises:
      waiter.OperationError: if the operation contains an error.

    Returns:
      the 'response' field of the Operation.
    zWaiting for [{0}] to finish)r	   WaitForCloudOperationPollerNoResourcesr#   projects_locations_operationsr   Name)r   operation_refs     r   WaitForOperationzVolumesClient.WaitForOperation?   sL     >>..KK55	
 	%,,]-?-?-AB r    Nc                 f   | j                   j                  |      }| j                  j                  j	                  |      }|j
                  D ]&  }t        j                  dj                  |             ( t        j                  | j                  j                  |t        j                  |d      S )ac  Make API calls to List active Cloud NetApp Volumes.

    Args:
      location_ref: The parsed location of the listed NetApp Volumes.
      limit: The number of Cloud NetApp Volumes to limit the results to. This
        limit is passed to the server and the server does the limiting.

    Returns:
      Generator that yields the Cloud NetApp Volumes.
    )parentzLocation {} may be unreachable.pageSize)fieldlimitbatch_size_attribute)r&   )NetappProjectsLocationsVolumesListRequestr#   projects_locations_volumesListunreachabler   warningr   r   YieldFromListr   VOLUME_RESOURCE)r   location_refr2   requestresponselocations         r   ListVolumeszVolumesClient.ListVolumesS   s     mmEE F G {{55::7CH((	kk3::8DE )##..''' r    c                 x   | j                   j                  |j                         j                         |j	                         |      }| j
                  j                  j                  |      }|r|S t        j                  j                  |j                  t        j                        }| j                  |      S )zCreate a Cloud NetApp Volume.)r/   volumeIdvolume
collection)r&   +NetappProjectsLocationsVolumesCreateRequestParentRelativeNamer+   r#   r5   Creater   REGISTRYParseRelativeNamenamer   OPERATIONS_COLLECTIONr-   )r   
volume_refasync_configr<   	create_opr,   s          r   CreateVolumezVolumesClient.CreateVolumem   s    mmGG  "//1" H G
 66==gFI&&889#B#B 9 M   //r    c                 l    | j                   j                  |||||||||	|
||||||||||||||||      S )zBParses the command line arguments for Create Volume into a config.)rK   capacitydescription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labelsblock_devices)r   ParseVolumeConfig)r   rK   rS   rT   rU   rV   rW   rX   rY   rZ   r[   r\   r]   r^   r_   r`   ra   rb   rc   rd   re   rf   rg   rh   ri   rj   rk   s                              r   rl   zVolumesClient.ParseVolumeConfig|   sn    < ==**!#)!'!-%'-#%-%&C))#5 +  r    c                     | j                   j                  |j                               }| j                  j                  j                  |      S )z$Get Cloud NetApp Volume information.)rK   )r&   (NetappProjectsLocationsVolumesGetRequestrG   r#   r5   Get)r   rM   r<   s      r   	GetVolumezVolumesClient.GetVolume   sE    mmDD$$& E G ;;1155g>>r    c                 |    | j                   j                  |j                         |      }| j                  ||      S )z(Deletes an existing Cloud NetApp Volume.)rK   force)r&   +NetappProjectsLocationsVolumesDeleteRequestrG   _DeleteVolume)r   rM   rN   rr   r<   s        r   DeleteVolumezVolumesClient.DeleteVolume   s?    mmGG$$&e H G fg..r    c                     | j                   j                  j                  |      }|r|S t        j                  j                  |j                  t        j                        }| j                  |      S )NrC   )
r#   r5   Deleter   rI   rJ   rK   r   rL   r-   )r   rN   r<   	delete_opr,   s        r   rt   zVolumesClient._DeleteVolume   sb    66==gFI&&889#B#B 9 M   //r    c                 r   | j                   j                  |j                         | j                   j                  |            }| j                  j
                  j                  |      }|r|S t        j                  j                  |j                  t        j                        }| j                  |      S )z(Reverts an existing Cloud NetApp Volume.)
snapshotId)rK   revertVolumeRequestrC   )r&   +NetappProjectsLocationsVolumesRevertRequestrG   RevertVolumeRequestr#   r5   Revertr   rI   rJ   rK   r   rL   r-   )r   rM   snapshot_idrN   r<   	revert_opr,   s          r   RevertVolumezVolumesClient.RevertVolume   s    mmGG$$& MM==" > 
 H G 66==gFI&&889#B#B 9 M   //r    c                 v   | j                   j                  |j                         | j                   j                  |||            }| j                  j
                  j                  |      }|r|S t        j                  j                  |j                  t        j                        }| j                  |      S )z2Restores specific files from a backup to a volume.)ra   fileListrestoreDestinationPath)rK   restoreBackupFilesRequestrC   )r&   ,NetappProjectsLocationsVolumesRestoreRequestrG   RestoreBackupFilesRequestr#   r5   Restorer   rI   rJ   rK   r   rL   r-   )	r   rM   ra   	file_listrestore_destination_pathrN   r<   
restore_opr,   s	            r   RestoreVolumezVolumesClient.RestoreVolume   s     mmHH$$&"&--"I"I#; #J #
 I G 77??HJ&&88I$C$C 9 M   //r    c                 j    | j                   j                  |||||||||	|
|||||||||||||||      S )z$Parses updates into a volume config.)rT   rj   rU   rV   rW   rX   rS   rY   rZ   r[   r\   r]   r^   r_   r`   ra   rb   rc   rd   re   rf   ri   rh   rk   )r   ParseUpdatedVolumeConfig)r   volume_configrT   rj   rU   rV   rW   rX   rS   rY   rZ   r[   r\   r]   r^   r_   r`   ra   rb   rc   rd   re   rf   ri   rh   rk   s                             r   r   z&VolumesClient.ParseUpdatedVolumeConfig   sk    : ==11!#)!'!-%'-#%-%))#3 2  r    c                     | j                   j                  |||      }|r|S t        j                  j	                  |j
                  t        j                        }| j                  |      S )aM  Updates a Cloud NetApp Volume.

    Args:
      volume_ref: the reference to the Volume.
      volume_config: Volume config, the updated volume.
      update_mask: str, a comma-separated list of updated fields.
      async_: bool, if False, wait for the operation to complete.

    Returns:
      an Operation or Volume message.
    rC   )	r   UpdateVolumer   rI   rJ   rK   r   rL   r-   )r   rM   r   update_maskrN   	update_opr,   s          r   r   zVolumesClient.UpdateVolume,  sg     **M;I &&889#B#B 9 M   //r    peer_cluster_namepeer_svm_namepeer_volume_namereturnc                 R    | j                   j                  ||||r|      S g       S )af  Parses the command line arguments for EstablishPeering into a config.

    Args:
      peer_cluster_name: The name of the peer cluster.
      peer_svm_name: The name of the peer SVM.
      peer_volume_name: The name of the peer volume.
      peer_ip_addresses: The list of peer IP addresses.

    Returns:
      An EstablishVolumePeeringRequest message.
    )peerClusterNamepeerSvmNamepeerVolumeNamepeerIpAddresses)r&   EstablishVolumePeeringRequest)r   r   r   r   peer_ip_addressess        r   (ParseEstablishVolumePeeringRequestConfigz6VolumesClient.ParseEstablishVolumePeeringRequestConfigB  sE    $ ==66)!'->)	 7   EG	 7  r    rM   'establish_volume_peering_request_configrN   c                 >   | j                   j                  |j                         |      }| j                  j                  j                  |      }|r|S t        j                  j                  |j                  t        j                        }| j                  |      S )a  Establish peering between GCNV volume and an onprem ONTAP volume.

    Args:
      volume_ref: The reference to the volume.
      establish_volume_peering_request_config: The config for the peering
        request.
      async_: If true, the call will return immediately, otherwise wait for
        operation to complete.

    Returns:
      An EstablishVolumePeering operation.
    )rK   establishVolumePeeringRequestrC   )r&   5NetappProjectsLocationsVolumesEstablishPeeringRequestrG   r#   r5   EstablishPeeringr   rI   rJ   rK   r   rL   r-   )r   rM   r   rN   r<   establish_peering_opr,   s          r   r   zVolumesClient.EstablishPeering[  s    $ mmQQ$$&&M R G
 	..??H  !!&&88!!i.M.M 9 M   //r    r"   NNNNNNNNNNNNNNNNNNNNNNNNNN)NNNNNNNNNNNNNNNNNNNNNNNN)__name__
__module____qualname____doc__r
   r   r   r   propertyr#   r&   r-   r?   rQ   rl   rp   ru   rt   r   r   r   r   strr   r   Volumeboolr    r    r   r   r   %   sf   N#'#4#4#:#:      " "(40" $(79v?/00 00 57r06   	 %200 0M0 	0r    r   c                       e Zd ZdZd Zd Zd Zd Zd Zd Z		 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 dd	Z
	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 dd
Zd Zd Zd Zej                   j"                  fdZd Zy)r   z7Adapter for the Cloud NetApp Files API Volume resource.c                     t         j                  j                  | _        t	        j
                  | j                        | _        t	        j                  | j                        | _        y N)r   )	r
   r   r   r   r   GetClientInstancer#   GetMessagesModuler&   r$   s    r   r   zVolumesAdapter.__init__  sF    **--D((t7I7IJDK**9K9KLDMr    c                 \   |sy| j                   j                         }|D ]  }| j                   j                         }|j                         D ]  \  }}|dk(  r||_        |dk(  r4| j                   j                  j
                  j                  |      |_        |dk(  r||_        |dk(  r||_	        |dk(  r||_
        |dk(  r||_        |dk(  r||_        |d	k(  r||_        |d
k(  r||_        |dk(  r||_        |dk(  s||_         |j"                  j%                  |        ||_        y)zParses Export Policy for Volume into a config.

    Args:
      volume: The Cloud NetApp Volume message object
      export_policy: the Export Policy message object.

    Returns:
      Volume message populated with Export Policy values.
    Nzallowed-clientszaccess-typezhas-root-accesszkerberos-5-read-onlyzkerberos-5-read-writezkerberos-5i-read-onlyzkerberos-5i-read-writezkerberos-5p-read-onlyzkerberos-5p-read-writenfsv3nfsv4)r&   ExportPolicySimpleExportPolicyRuleitemsallowedClientsAccessTypeValueValuesEnumlookup_by_name
accessTypehasRootAccesskerberos5ReadOnlykerberos5ReadWritekerberos5iReadOnlykerberos5iReadWritekerberos5pReadOnlykerberos5pReadWriter   r   rulesappendexportPolicy)r   rB   rX   export_policy_configpolicysimple_export_policy_rulekeyvals           r   ParseExportPolicyz VolumesAdapter.ParseExportPolicy  sP    ==557"&--"F"F"Hlln(#s##58
#
2-151U1U1o1o1~1~2
#
. ##47
#
1((8;
#
5))9<
#
6))9<
#
6**:=
#
7))9<
#
6**:=
#
7'>,/
#
)'>,/
#
)1 %2   ''(AB7  8 /Fr    c                 H   g |_         |y|D ]  }| j                  j                         }d|v r
|d   |_        |j	                  dg       D ]  }|j
                  j                  |        d|v r
|d   |_        d|v r
|d   |_        |j                   j                  |        y)z.Parses Block Devices for Volume into a config.NrK   zhost-groupszos-typezsize-gib)	blockDevicesr&   BlockDevicerK   get
hostGroupsr   osTypesizeGib)r   rB   rk   block_device_argsblock_device_message
host_groups         r   ParseBlockDevicesz VolumesAdapter.ParseBlockDevices  s     F*!]]668	$	$$5f$=!)--mR@*''..z: A	'	'&7	&B#	(	('8'D$  !56 +r    c                 F    g }|D ]  }|j                  |        ||_        y)zParses Protocols from a list of Protocol Enums into the given volume.

    Args:
      volume: The Cloud NetApp Volume message object
      protocols: A list of protocol enums

    Returns:
      Volume message populated with protocol values.
    N)r   rV   )r   rB   rV   protocols_configprotocols        r   ParseProtocolszVolumesAdapter.ParseProtocols  s*     h' 'Fr    c                 x   |sy| j                   j                         |_        d|j                  _        |j	                         D ]  \  }}|dk(  rY| j                   j                         }|j                  d      |_        |j                  dd      |_        ||j                  _	        e|dk(  rp| j                   j                         }|j                  d      |_        |j                  dd      |_        |j                  dd      |_        ||j                  _        |d	k(  r| j                   j                         }|j                  d      |_        |j                  dd      |_        |j                  dd      |_        |j                  d
d      |_        ||j                  _        g|dk(  sn| j                   j!                         }|j                  d      |_        |j                  dd      |_        |j                  dd      |_        |j                  d
d      |_        ||j                  _         y)a"  Parses Snapshot Policy from a list of snapshot schedules into a given Volume.

    Args:
      volume: The Cloud NetApp Volume message object
      snapshot_policy: A list of snapshot policies (schedules) to parse

    Returns:
      Volume messages populated with snapshotPolicy field
    NThourly_snapshotzsnapshots-to-keepminuter   daily_snapshothourweekly_snapshotdaySundayzmonthly-snapshot   )r&   SnapshotPolicysnapshotPolicyenabledr   HourlyScheduler   snapshotsToKeepr   hourlyScheduleDailyScheduler   dailyScheduleWeeklyScheduler   weeklyScheduleMonthlySchedulemonthlySchedule)r   rB   r[   rK   snapshot_scheduleschedules         r   ParseSnapshotPolicyz"VolumesAdapter.ParseSnapshotPolicy  s     MM88:F$(F!#2#8#8#:	"	"==//1#4#8#89L#M +//!</7,##==..0#4#8#89L#M +//!<)--fa8.6+$$==//1#4#8#89L#M +//!<)--fa8(,,UH=/7,%%==002#4#8#89L#M +//!<)--fa8(,,UA608-3 $;r    c                     | j                   j                  ||j                         |      }| j                  j                  j                  |      }|S )z1Send a Patch request for the Cloud NetApp Volume.)rB   rK   
updateMask)r&   *NetappProjectsLocationsVolumesPatchRequestrG   r#   r5   Patch)r   rM   r   r   update_requestr   s         r   r   zVolumesAdapter.UpdateVolume  sP    ]]MM$$& N N
 66<<^LIr    Nc                 z   | j                   j                         }||_        ||_        ||_        ||_        ||_        ||_        | j                  ||       | j                  ||       ||_
        |	|_        | j                  ||
       ||_        ||_        ||_        ||_        | j                   j#                         }|||_        |||_        ||d}||_        ||_        ||_        || j/                  ||       |||_        |||_        || j5                  ||       || j7                  ||| j8                         | j8                  t:        j<                  j>                  k(  s'| j8                  t:        j<                  j@                  k(  r|| jC                  ||       || jE                  ||       |S )a  Parses the command line arguments for Create Volume into a config.

    Args:
      name: the name of the Volume
      capacity: the storage capacity of the Volume.
      description: the description of the Volume.
      storage_pool: the Storage Pool the Volume is attached to.
      protocols: the type of fileshare protocol of the Volume.
      share_name: the share name or mount point of the Volume.
      export_policy: the export policy of the Volume if NFS.
      unix_permissions: the Unix permissions for the Volume.
      smb_settings: the SMB settings for the Volume.
      snapshot_policy: the Snapshot Policy for the Volume
      snap_reserve: the snap reserve (double) for the Volume
      snapshot_directory: Bool on whether to use snapshot directory for Volume
      security_style: the security style of the Volume
      enable_kerberos: Bool on whether to use kerberos for Volume
      snapshot: the snapshot name to create Volume from
      backup: the backup to create the Volume from.
      restricted_actions: the actions to be restricted on a Volume
      backup_config: the Backup Config attached to the Volume
      large_capacity: Bool on whether to use large capacity for Volume
      multiple_endpoints: Bool on whether to use multiple endpoints for Volume
      tiering_policy: the tiering policy for the volume.
      hybrid_replication_parameters: the hybrid replication parameters for the
        volume.
      throughput_mibps: throughput of the Volume (in MiB/s).
      cache_parameters: the cache parameters for the volume.
      labels: the parsed labels value.
      block_devices: the block devices for the volume.

    Returns:
      the configuration that will be used as the request body for creating a
      Cloud NetApp Files Volume.
    N)#r&   r   rK   capacityGibrT   rj   storagePool	shareNamer   r   unixPermissionssmbSettingsr   snapReservesnapshotDirectorysecurityStylekerberosEnabledRestoreParameterssourceSnapshotsourceBackuprestoreParametersrestrictedActionsthroughputMibpsParseBackupConfiglargeCapacitymultipleEndpointsParseTieringPolicy ParseHybridReplicationParametersr   r
   r   r   r   r   ParseCacheParameters)r   rK   rS   rT   rU   rV   rW   rX   rY   rZ   r[   r\   r]   r^   r_   r`   ra   rb   rc   rd   re   rf   rg   rh   ri   rj   rk   rB   restore_parameterss                                r   rl   z VolumesAdapter.ParseVolumeConfig  s   @ ]]!!#FFK!F$FFM%F!F6=1	*-F%FV_5%F1F)F,F88:*2'(.%~(*1F1F-F 
V]3!+f%!3f!
fn5$0
++
/1C1C 	d//555!2!2!7!77		"v}5#
(89Mr    c                    |||_         |||_        |||_        |||_        || j	                  ||       |||_        || j                  ||       |	|	|_        |
|
|_        || j                  ||       |||_
        |||_        |||_        |||_        |||_        ||| j                  |||       |||_        || j#                  ||       |||_        |||_        || j)                  ||       || j+                  ||       |||_        |R| j.                  t0        j2                  j4                  t0        j2                  j6                  fv r| j9                  ||       |S )z8Parse update information into an updated Volume message.)rT   rj   r   r   r   r   r   r   r   r   r  r  r  r  activeDirectoryParseRestoreParametersr	  r  r  r  r  r  r
  r   r
   r   r   r   r   )r   r   rT   rj   rU   rV   rW   rX   rS   rY   rZ   r[   r\   r]   r^   r_   active_directoryr`   ra   rb   rc   rd   re   rf   ri   rh   rk   s                              r   r   z'VolumesAdapter.ParseUpdatedVolumeConfigs  s   < "-m#m"*m".m
-3 *m 
]M:#&6m#".m"
}o>".m%(:m%!$2m!"&5m##&6m#v1
!!-6B%(:m% 
]M:!$2m!%(:m%!
m^<#
/?@#&6m# T%7%7< & ]M:r    c                    | j                   j                         }|j                  dg       D ]  }|j                  j	                  |        |j                  dd      |_        |j                  dd      |_        ||_        y)zParses Backup Config for Volume into a config.

    Args:
      volume: The Cloud NetApp Volume message object.
      backup_config: the Backup Config message object.

    Returns:
      Volume message populated with Backup Config values.
    zbackup-policieszbackup-vault zenable-scheduled-backupsN)r&   BackupConfigr   backupPoliciesr   backupVaultscheduledBackupEnabledbackupConfig)r   rB   rc   backup_config_messagebackup_policys        r   r  z VolumesAdapter.ParseBackupConfig  s}     !MM668&**+<bA**11-@ B(5(9(9."(M%3@3D3D"D40 0Fr    c                 j    | j                   j                         }|r||_        |r||_        ||_        y)z3Parses Restore Parameters for Volume into a config.N)r&   r  r  r  r  )r   rB   r`   ra   r  s        r   r  z%VolumesAdapter.ParseRestoreParameters  s5    88:*2'(.%1Fr    c                 f   | j                   j                         }|j                  d      |_        |j                  d      |_        | j
                  t        j                  j                  k(  s'| j
                  t        j                  j                  k(  r|j                  d      |_
        ||_        y)zParses Tiering Policy for Volume into a config.

    Args:
      volume: The Cloud NetApp Volume message object.
      tiering_policy: the tiering policy message object.

    Returns:
      Volume message populated with Tiering Policy values.
    ztier-actionzcooling-threshold-dayszenable-hot-tier-bypass-modeN)r&   TieringPolicyr   
tierActioncoolingThresholdDaysr   r
   r   r   r   hotTierBypassModeEnabledtieringPolicy)r   rB   rf   tiering_policy_messages       r   r  z!VolumesAdapter.ParseTieringPolicy  s     "]]88:(6(:(:=(I%2@2D2D 3/ 	d//444!2!2!8!888F8J8J
'95 2Fr    c                 z   ~| j                   j                         }|j                  d      |_        |j                  d      |_        |j                  d      |_        |j                  d      |_        |j                  dg       D ]  }|j                  j                  |        |j                  d      |_	        |j                  d      |_
        | j                   j                  j                  |j                  dg       D cg c]W  }| j                   j                  j                  j                  |j                  d	      d
   |j                  d	      d         Y c}      |_        |j                  d      |_        |j                  d      |_        |j                  d      |_        ||_        yc c}w )af  Parses Hybrid Replication Parameters for Volume into a config.

    Args:
      volume: The Cloud NetApp Volume message object.
      hybrid_replication_parameters: The hybrid replication params message
        object.
      release_track: The release track of the command.

    Returns:
      Volume message populated with Hybrid Replication Parameters
    replicationpeer-volume-namepeer-cluster-namepeer-svm-namepeer-ip-addresseszcluster-locationrT   rj   :r   r   )r   value)additionalPropertieszreplication-schedulezhybrid-replication-typezlarge-volume-constituent-countN)r&   HybridReplicationParametersr   r(  r   r   r   r   r   clusterLocationrT   LabelsValueAdditionalPropertysplitrj   replicationSchedulehybridReplicationTypelargeVolumeConstituentCounthybridReplicationParameters)r   rB   rg   r   %hybrid_replication_parameters_message
ip_addresskey_value_pairs          r   r  z/VolumesAdapter.ParseHybridReplicationParameters  s   " 	113 * 	&))-8 *5 	&))*<= *8 	&))*=> *9 	&))/: *5 477R
 ,;;BB:N
 	&))*<= *9 	&))-8 *5 48==3\3\3h3h #@"C"C"#

#	 MM55AATT"((-a0$**3/2 U #
 4i 
4)0 	&))*@A *= 	&))*CD *? 	&))*JK *E *OF&)
s   AF8c                 
   | j                   j                         }|j                  d      |_        |j                  d      |_        |j                  d      |_        |j                  dg       D ]  }|j                  j                  |        |j                  d      |_        | j                   j                         }|j                  dg       D ]"  }d|v s|d   j                         dk(  |_        $ ||_        ||_        y	)
zParses Cache Parameters for Volume into a config.

    Args:
      volume: The Cloud NetApp Volume message object.
      cache_parameters: The cache params message object.

    Returns:
      Volume message populated with Cache Parameters
    r)  r*  r+  r,  zenable-global-file-lockzcache-configzcifs-change-notify-enabledtrueN)r&   CacheParametersr   r   r   r   r   r   enableGlobalFileLockCacheConfiglowercifsChangeNotifyEnabledcacheConfigcacheParameters)r   rB   ri   cache_parameters_messager:  cache_config_messagerO   s          r   r  z#VolumesAdapter.ParseCacheParameters=  s     $}}<<>.>.B.B/+ 0@/C/C0, ,<+?+?+P(&**+>C
..55jA D4D4H4H!51  ==446"&&~r: 
&	//0668FB 	4 ; ,@(5Fr    r   )NNNNNNNNNNNNNNNNNNNNNNNNN)r   r   r   r   r   r   r   r   r   r   rl   r   r  r  r  r
   r   r   r  r  r   r    r   r   r   |  s    ?M
)/V7$('9R $(7nf 7Qf0(228 %%((	@OD(6r    r   c                   "     e Zd ZdZ fdZ xZS )r   z<Adapter for the Beta Cloud NetApp Files API Volume resource.c                     t         t        |           t        j                  j
                  | _        t        j                  | j                        | _	        t        j                  | j                        | _        y r   )superr   r   r
   r   r   r   r   r   r#   r   r&   r   	__class__s    r   r   zBetaVolumesAdapter.__init__k  sU    	
d,.**//D((t7I7IJDK**9K9KLDMr    r   r   r   r   r   __classcell__rK  s   @r   r   r   h  s    DM Mr    r   c                   "     e Zd ZdZ fdZ xZS )r   z=Adapter for the Alpha Cloud NetApp Files API Volume resource.c                     t         t        |           t        j                  j
                  | _        t        j                  | j                        | _	        t        j                  | j                        | _        y r   )rI  r   r   r
   r   r   r   r   r   r#   r   r&   rJ  s    r   r   zAlphaVolumesAdapter.__init__u  sU    	
t-/**00D((t7I7IJDK**9K9KLDMr    rL  rN  s   @r   r   r   r  s    EM Mr    r   N)r   
__future__r   r   r   apitools.base.pyr   googlecloudsdk.api_lib.netappr   r   googlecloudsdk.api_lib.utilr	   googlecloudsdk.callioper
   googlecloudsdk.corer   r   4googlecloudsdk.generated_clients.apis.netapp.v1beta1r   r   r   objectr   r   r   r   r   r    r   <module>rY     s    P &  ' ' 3 . . ( # ) X 99  
!	'	'T0F T0n
i6V i6XM MM, Mr    