
                         f    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 r	SS	 jr
S
 rS rS rg)z.Spanner instance config operations API helper.    )
list_pager)apis)waiter)
properties)	resourcesc                 j   [         R                  " SS5      n[         R                  " SS5      n[        R                  R                  U[        R                  R                  R                  R                  U S.SS9nUR                  UR                  5       S9nUR                  R                  U5      $ )zGets the specified operation.spannerv1
projectsIdinstanceConfigsId+spanner.projects.instanceConfigs.operationsparams
collectionname)r   GetClientInstanceGetMessagesModuler   REGISTRYParser   VALUEScoreproject	GetOrFail2SpannerProjectsInstanceConfigsOperationsGetRequestRelativeName#projects_instanceConfigs_operationsGetconfig	operationclientmsgsrefreqs         @lib/googlecloudsdk/api_lib/spanner/instance_config_operations.pyr   r      s    !!)T2&				4	0$  "))..66@@% ? 	! 	@# 	?? 	@ 	#		3	3	7	7	<<    Nc                 |   [         R                  " SS5      n[         R                  " SS5      n[        R                  R                  U S[        R                  R                  R                  R                  0SS9nUR                  UR                  5       S-   US9n[        R                  " UR                  USS	S
9$ )zGList operations on instanceConfig using the generic operation list API.r	   r
   r   z spanner.projects.instanceConfigsr   z/operations)r   filter
operationspageSize)fieldbatch_size_attribute)r   r   r   r   r   r   r   r   r   r   r   3SpannerProjectsInstanceConfigsOperationsListRequestr   r   YieldFromListr   )r!   type_filterr#   r$   r%   r&   s         r'   Listr2   )   s    !!)T2&				4	0$  J--22::DDE3 	! 	5# 	@@-k 	A 	C#		!	!00	%	
' 'r(   c                 j   [         R                  " SS5      n[         R                  " SS5      n[        R                  R                  U[        R                  R                  R                  R                  U S.SS9nUR                  UR                  5       S9nUR                  R                  U5      $ )zCancel the specified operation.r	   r
   r   r   r   r   )r   r   r   r   r   r   r   r   r   r   r   5SpannerProjectsInstanceConfigsOperationsCancelRequestr   r   Cancelr    s         r'   r5   r5   :   s    !!)T2&				4	0$  "))..66@@% ? 	! 	@# 	BB 	C 	#		3	3	:	:3	??r(   c                    [         R                  " SS5      n[        R                  " UR                  UR
                  5      n[        R                  R                  U R                  SS9n[        R                  " X4U5      $ )z!Wait for the specified operation.r	   r
   r   )r   )r   r   r   CloudOperationPollerprojects_instanceConfigsr   r   r   ParseRelativeNamer   WaitFor)r"   messager#   pollerr%   s        r'   Awaitr=   J   so    !!)T2&&&%%002& 	,,nn!N 	- 	P#	W	--r(   c                 <    U c  gSnU S:X  a  US-   $ U S:X  a  US-   $ g)zMBuilds the filter for the different instance config operation metadata types.N zDmetadata.@type:type.googleapis.com/google.spanner.admin.instance.v1.INSTANCE_CONFIG_CREATECreateInstanceConfigMetadataINSTANCE_CONFIG_UPDATEUpdateInstanceConfigMetadata )op_typebase_strings     r'   &BuildInstanceConfigOperationTypeFilterrG   U   s>    _V+((777((777 )r(   )N)__doc__apitools.base.pyr   googlecloudsdk.api_lib.utilr   r   googlecloudsdk.corer   r   r   r2   r5   r=   rG   rD   r(   r'   <module>rL      s5    5 ( , . * )= '"@ .
8r(   