
                             S 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.    N)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_configr.   
create_reqs              r   r8   InstancesClient.Create0   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   :SecuresourcemanagerProjectsLocationsInstancesDeleteRequestr7   r   Delete)r#   r9   
delete_reqs      r   rG   InstancesClient.Deleted   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!   ParseRelativeNamerE   )r#   	operations     r   GetOperationRefInstancesClient.GetOperationRefs   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WaitForrO   )r#   operation_refmessage
has_resultmax_waitpollers         r   WaitForOperation InstancesClient.WaitForOperationy   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/{}rD   zhttps://{}/)r   7SecuresourcemanagerProjectsLocationsInstancesGetRequestformatr7   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$   r8   rG   rM   datetime	timedeltar[   rg   __static_attributes__ r   r   r   r   &   s9    3I2,h, !!#.$L
.r   r   )rm   rn   googlecloudsdk.api_lib.utilr   r   googlecloudsdk.callioper   googlecloudsdk.corer   r   r   r   r   r   objectr   rq   r   r   <module>rv      sm    9  , . ( )  &&- %)$5$5$;$; D
 %)$5$5$;$; D
C.f C.r   