
    
                         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 rS rS rS rS rg)zFCommon utility functions for Cloud Filestore update snapshot commands.    )absolute_import)division)unicode_literals)encoding)filestore_client)update_util)util)
properties)	resourcesc                 ~    [         R                  " X[         R                  5      nU(       a  X2R                  l        U$ )zUpdate snapshot labels.)r   GetUpdatedLabelssnapshot_feature_namesnapshotlabels)
unused_refargsreq
new_labelss       Alib/googlecloudsdk/command_lib/filestore/snapshots/update_util.pyUpdateLabelsr      s0    ++D,7,M,MO*$LL	*    c                 N    [         R                  " XU[         R                  5      $ )N)r   AddDescriptionr   )unused_instance_refr   patch_requests      r   r   r   &   s%    		#	#$7}$/$E$E
G Gr   c                     [         R                  R                  R                  R	                  SS9nU R
                  =(       d    U R                  n[        R                  R                  SUUU R                  S9nU$ )NT)requiredz!file.projects.locations.snapshots)
projectsIdlocationsIdsnapshotsId)r
   VALUEScoreprojectGetregionzoner   REGISTRYCreater   )r   r#   locationrefs       r   GetResourceRefr+   +   sk    ""**...='[[%DII(!!)--	 	" 	!#
 
*r   c                     [        U5      n[        R                  " U5      n[        R                  " U5      nUR                  U5      nXbl        U$ )zHFetch existing Filestore instance to update and add it to Patch request.)r+   r	   GetApiVersionFromArgsr   FilestoreClientGetSnapshotr   )unused_resource_refr   r   resource_refapi_versionclientorig_snapshots          r   GetExistingSnapshotr5   6   sH    %,**40+++K8&$$\2-(	r   c                     A [        U5      n[        R                  " U5      n[        R                  " U5      n[
        R                  " UR                  U5      5      $ )z5Python hook to generate the snapshot update response.)r+   r	   r-   r   r.   r   MessageToDictr/   )responser   r1   r2   r3   s        r   FormatSnapshotUpdateResponser9   @   sK    %,**40+++K8&			 2 2< @	AAr   N)__doc__
__future__r   r   r   apitools.base.pyr    googlecloudsdk.api_lib.filestorer   $googlecloudsdk.command_lib.filestorer   r	   googlecloudsdk.corer
   r   r   r   r+   r5   r9    r   r   <module>rA      sA    M &  ' % = < 5 * )G
Br   