
    l                        S r SSKJr  SSKJr  SSKJr  SSKrSSKJr  SSKJr  SSK	J
r
  SS	KJr  \
R                  R                  S
0r\
R                  R                  4S jr\
R                  R                  4S jr " S S\5      rg)z2The Secure Source Manager instances client module.    )absolute_import)division)unicode_literalsN)apis)waiter)base)	resourcesv1c                 Z    [         R                  U 5      n[        R                  " SU5      $ Nsecuresourcemanager)VERSION_MAPgetr   GetMessagesModulerelease_trackapi_versions     ;lib/googlecloudsdk/api_lib/securesourcemanager/instances.pyr   r      $    .+			 5{	CC    c                 Z    [         R                  U 5      n[        R                  " SU5      $ r   )r   r   r   GetClientInstancer   s     r   r   r   $   r   r   c                   `    \ rS rSrSrS rS rS rS rS\	R                  " SS	94S
 jrS rSrg)InstancesClient)   z+Client for Secure Source Manager instances.c                 F   [        [        R                  R                  5      U l        [        [        R                  R                  5      U l        U R                  R                  U l        [        R                  " 5       U l        U R                  R                  SS5        g )Nr   r
   )r   r   ReleaseTrackALPHAclientr   messagesprojects_locations_instances_servicer	   Registry_resource_parserRegisterApiByName)selfs    r   __init__InstancesClient.__init__,   sk    #D$5$5$;$;<DK%d&7&7&=&=>DMKK<<DM%..0D++,A4Hr   c                 |   SnU(       a  U R                   R                  UUUS9nSnU(       a  U R                   R                  US9nU R                   R                  UUUS9n	U R                   R	                  U	UR
                  UR                  5       R                  5       S9n
U R                  R                  U
5      $ )a$  Create a new Secure Source Manager instance.

Args:
  instance_ref: a resource reference to
    securesourcemanager.projects.locations.instances.
  kms_key: customer managed encrypted key to create instance.
  is_private:  boolean indicator for private instance.
  ca_pool: path of ca pool for private instance.
  enable_workforce_identity_federation: boolean indicator for workforce
    identity federation.
  psc_allowed_projects: list of projects allowed to connect to the instance
    via Private Service Connect.

Returns:
  Created instance.
N)	isPrivatecaPoolpscAllowedProjects)enabled)kmsKeyprivateConfig!workforceIdentityFederationConfig)instance
instanceIdparent)
r    PrivateConfig!WorkforceIdentityFederationConfigInstance:SecuresourcemanagerProjectsLocationsInstancesCreateRequestinstancesIdParentRelativeNamer"   Create)r&   instance_refkms_key
is_privateca_pool$enable_workforce_identity_federationpsc_allowed_projectsprivate_config$workforce_identity_federation_configr1   
create_reqs              r   r;   InstancesClient.Create3   s    2 N}}221 3 n
 ,0(+
--
9
9: :  +
 }}%%$*N & H YY++""$113 Z J
 ==
++r   c                     U R                   R                  UR                  5       S9nU R                  R	                  U5      $ )zDelete a Secure Source Manager instance.

Args:
  instance_ref: a resource reference to
    securesourcemanager.projects.locations.instances.

Returns:
  None
name)r    :SecuresourcemanagerProjectsLocationsInstancesDeleteRequestr:   r"   Delete)r&   r<   
delete_reqs      r   rJ   InstancesClient.Deleteg   sA     YY&&( Z J ==
++r   c                 N    U R                   R                  UR                  S5      $ )zKConverts an operation to a resource that can be used with `waiter.WaitFor`.z1securesourcemanager.projects.locations.operations)r$   ParseRelativeNamerH   )r&   	operations     r   GetOperationRefInstancesClient.GetOperationRefv   s%      22K r   TiX  )secondsc                 (   U(       a@  [         R                  " U R                  R                  U R                  R                  5      nO*[         R
                  " U R                  R                  5      n[         R                  " XQX$R                  S-  S9$ )a  Waits for a Secure Source Manager operation to complete.

  Polls the Secure Source Manager Operation service until the operation
  completes, fails, or max_wait_seconds elapses.

Args:
  operation_ref: a resource reference created by GetOperationRef describing
    the operation.
  message: a message to display to the user while they wait.
  has_result: If True, the function will return the target of the operation
    (i.e. the Secure Source Manager instance) when it completes. If False,
    nothing will be returned (useful for Delete operations).
  max_wait: The time to wait for the operation to complete before returning.

Returns:
  A Secure Source Manager resource or None
i  )max_wait_ms)r   CloudOperationPollerr   r!   projects_locations_operationsCloudOperationPollerNoResourcesWaitForrR   )r&   operation_refmessage
has_resultmax_waitpollers         r   WaitForOperation InstancesClient.WaitForOperation|   ss    0 **
++
2
2
++
3
3f
 55
++
3
3f >>w4D4Dt4K r   c                     U R                   R                  SR                  UR                  5       U5      S9nU R                  R                  U5      R                  R                  nSR                  U5      $ )z(Get the API URL of a Cloud Git instance.z{}/instances/{}rG   zhttps://{}/)r    7SecuresourcemanagerProjectsLocationsInstancesGetRequestformatr:   r"   Get
hostConfigapi)r&   location_refinstance_idget_reqapi_base_urls        r   GetApiBaseUrlInstancesClient.GetApiBaseUrl   sp     	MM"))))+[ 	N 	
  ==$$W-88<<L--r   )r$   r"   r   r    N)__name__
__module____qualname____firstlineno____doc__r'   r;   rJ   rP   datetime	timedeltar^   rj   __static_attributes__ r   r   r   r   )   s9    3I2,h, !!#.$L
.r   r   )rp   
__future__r   r   r   rq   googlecloudsdk.api_lib.utilr   r   googlecloudsdk.callioper   googlecloudsdk.corer	   r   r   r   r   r   objectr   rt   r   r   <module>rz      st    9 &  '  , . ( )  &&- %)$5$5$;$; D
 %)$5$5$;$; D
C.f C.r   