
    W                         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
 r " S S\5      rg)z%API library for Authorized Orgs Desc.    )absolute_import)division)unicode_literals)
list_pager)util)waiter)log)	resourcesc                 F    Ub  [        X U5        UR                  U 5        gg)a  Sets specified field to the provided value and adds it to update mask.

Args:
  field_name: The name of the field to set the value of.
  field_value: The value to set the field to. If it is None, the field will
    NOT be set.
  obj: The object on which the value is to be set.
  update_mask: The update mask to add this field to.

Returns:
  True if the field was set and False otherwise.
TF)setattrappend)
field_namefield_valueobjupdate_masks       Blib/googlecloudsdk/api_lib/accesscontextmanager/authorized_orgs.py_SetIfNotNoner      s(     C[)z"	    c                   B    \ rS rSrSrS
S jrS rSS jrS rSS jr	S	r
g)Client1   z*High-level API client for Authorized Orgs.Nc                     U=(       d    [         R                  " US9U l        U=(       d    U R                  R                  U l        g )N)version)r   	GetClientclientMESSAGES_MODULEmessages)selfr   r   r   s       r   __init__Client.__init__4   s-    ;DNN7;DK; ; ;DMr   c                     U R                   R                  R                  U R                  R	                  UR                  5       S95      $ )N)name)r   "accessPolicies_authorizedOrgsDescsGetr   ?AccesscontextmanagerAccessPoliciesAuthorizedOrgsDescsGetRequestRelativeName)r   authorized_orgs_desc_refs     r   r$   
Client.Get8   sC    ;;99==	H	H)668 
I 
:; ;r   c           	          U R                   R                  UR                  5       S9n[        R                  " U R
                  R                  UUSS SS9$ )N)parentpageSizeauthorizedOrgsDescs)limitbatch_size_attribute
batch_sizefield)r   @AccesscontextmanagerAccessPoliciesAuthorizedOrgsDescsListRequestr&   r   YieldFromListr   r#   )r   
policy_refr-   reqs       r   ListClient.List>   sW    
--
X
X&&( Y *C##66'#% %r   c                    U R                   nUR                  nU" UUR                  5       SR                  U5      S9nU R                  R
                  R                  U5      n[        R                  " U R                  R
                  U R                  R                  U5      n[        R                  R                  UR                  SS9n	[        R                  " XSR!                  U	R#                  5       5      5      $ )z5Applies a PATCH to the provided Authorized Orgs Desc.,)authorizedOrgsDescr"   
updateMaskzaccesscontextmanager.operations)
collectionz Waiting for PATCH operation [{}])r   AAccesscontextmanagerAccessPoliciesAuthorizedOrgsDescsPatchRequestr&   joinr   r#   Patchr   OperationPoller
operationscore_resourcesREGISTRYParser"   r   WaitForformatName)
r   r'   authorized_orgs_descr   mrequest_typerequest	operationpolleroperation_refs
             r   _ApplyPatchClient._ApplyPatchI   s     	A	KK /%22488K(G
 >>DDWMI!!668N8N "F #++11#D 2 FM>>*11-2D2D2FGI Ir   c                     U R                   nUR                  5       n/ n[        SX$U5        U(       d  [        R                  " S5        U$ U R                  XU5      $ )a$  Patch an authorized orgs desc.

Args:
  authorized_orgs_desc_ref: AuthorizedOrgsDesc, reference to the
    authorizedOrgsDesc to patch
  orgs: list of str, the names of orgs ( 'organizations/...') or None if not
    updating.

Returns:
  AuthorizedOrgsDesc, the updated Authorized Orgs Desc.
orgszHThe update specified results in an identical resource. Skipping request.)r   AuthorizedOrgsDescr   r	   warningrN   )r   r'   rQ   rH   rG   r   s         r   r>   Client.Patch^   sb     	A//1K&$kB 	kk
T "!4') )r   )r   r   )NNv1)N)__name__
__module____qualname____firstlineno____doc__r   r$   r5   rN   r>   __static_attributes__ r   r   r   r   1   s    2<;	%I*)r   r   N)rZ   
__future__r   r   r   apitools.base.pyr   +googlecloudsdk.api_lib.accesscontextmanagerr   googlecloudsdk.api_lib.utilr   googlecloudsdk.corer	   r
   rA   r   objectr   r\   r   r   <module>rc      s5    , &  ' ' < . # ;(G)V G)r   