
    T                        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  SS
KJr  \R                  R                   S\R                  R"                  S\R                  R$                  S0rSr\R                  R"                  4S jr\R                  R"                  4S jr\R                  R"                  4S jr\R                  R"                  4S jr " S S5      rg)zIAPI wrapper for `gcloud network-security intercept-deployments` commands.    )absolute_import)division)unicode_literalsN)
list_pager)apis)waiter)base)	resourcesv1alpha1v1beta1v1networksecurityc                 N    [        U 5      n[        R                  " [        U5      $ N)GetApiVersionr   GetMessagesModule	_API_NAMErelease_trackapi_versions     Hlib/googlecloudsdk/api_lib/network_security/intercept_deployments/api.pyr   r   &       m,+				;	77    c                 N    [        U 5      n[        R                  " [        U5      $ r   )r   r   GetClientInstancer   r   s     r   r   r   +   r   r   c                 N    [        U 5      n[        R                  " [        U5      $ r   )r   r   GetEffectiveApiEndpointr   r   s     r   r   r   0   s    m,+		%	%i	==r   c                 ,    [         R                  U 5      $ r   )_API_VERSION_FOR_TRACKget)r   s    r   r   r   5   s    		#	#M	22r   c                   z    \ rS rSrSrS r  SS jrS rS rS r	 SS	 jr
S
 rS\R                  " SS94S jrSrg)Client9   zAPI client for Intercept Deployments commands.

Attributes:
  messages: API messages class, The Network Security API messages.
c                 6   [        U5      U l        U R                  R                  U l        U R                  R                  U l        [        U5      U l        [        R                  " 5       U l
        U R                  R                  [        [        U5      5        g r   )r   _client'projects_locations_interceptDeployments_deployments_clientprojects_locations_operations_operations_clientr   messagesr
   Registry_resource_parserRegisterApiByNamer   r   )selfr   s     r   __init__Client.__init__@   sr    $]3DL<< 	 #llHHD%m4DM%..0D++=/r   Nc                     U R                   R                  UUUS9n[        US5      (       a  XGl        U R                   R	                  UUUS9nU R
                  R                  U5      $ )a  Calls the CreateInterceptDeployment API.

Args:
  parent: The parent of the deployment, e.g.
    "projects/myproj/locations/us-central1"
  forwarding_rule: The forwarding rule of the deployment, e.g.
    "projects/myproj/regions/us-central1/forwardingRules/my-rule"
  intercept_deployment_group: The deployment group of the deployment, e.g.
    "projects/myproj/locations/global/interceptDeploymentGroups/my-group"
  description: The description of the deployment.
  deployment_id: The ID of the deployment, e.g. "my-deployment".
  labels: A dictionary with the labels of the deployment.

Returns:
  NetworksecurityProjectsLocationsInterceptDeploymentsCreateResponse
)forwardingRuleinterceptDeploymentGrouplabelsdescription)interceptDeploymentinterceptDeploymentIdparent)r*   InterceptDeploymenthasattrr5   ANetworksecurityProjectsLocationsInterceptDeploymentsCreateRequestr'   Create)	r.   r8   forwarding_ruleintercept_deployment_groupr5   deployment_idr4   
deploymentcreate_requests	            r   CreateDeploymentClient.CreateDeploymentL   sw    4 22&!; 3 J z=))*]]dd&+ e N
 ##**>::r   c                 j    U R                   R                  US9nU R                  R                  U5      $ )z(Calls the DeleteInterceptDeployment API.name)r*   ANetworksecurityProjectsLocationsInterceptDeploymentsDeleteRequestr'   Delete)r.   rF   delete_requests      r   DeleteDeploymentClient.DeleteDeploymentw   s8    ]]dd e N ##**>::r   c                 (   U R                   R                  UR                  SS5      S9n[        US5      (       a  X$l        U R                   R                  UUSR                  UR                  5       5      S9nU R                  R                  U5      $ )a  Calls the UpdateInterceptDeployment API.

Args:
  name: The name of the deployment.
  description: The description of the deployment.
  update_fields: A dictionary of the fields to update mapped to their new
    values.

Returns:
  Operation ref to track the long-running process.
r4   N)r4   r5   ,)rF   r6   
updateMask)
r*   r9   r    r:   r5   @NetworksecurityProjectsLocationsInterceptDeploymentsPatchRequestjoinkeysr'   Patch)r.   rF   r5   update_fieldsr@   update_requests         r   UpdateDeploymentClient.UpdateDeployment~   s    " 22  40 3 J
 z=))*]]cc&88M..01 d N
 ##)).99r   c                 j    U R                   R                  US9nU R                  R                  U5      $ )z%Calls the GetInterceptDeployment API.rE   )r*   >NetworksecurityProjectsLocationsInterceptDeploymentsGetRequestr'   Get)r.   rF   get_requests      r   DescribeDeploymentClient.DescribeDeployment   s8    --^^ _ K ##''44r   c           	      z    U R                   R                  XS9n[        R                  " U R                  UUUSSS9$ )z'Calls the ListInterceptDeployments API.)r8   filterinterceptDeploymentspageSize)
batch_sizelimitfieldbatch_size_attribute)r*   ?NetworksecurityProjectsLocationsInterceptDeploymentsListRequestr   YieldFromListr'   )r.   r8   rb   	page_sizelist_filterlist_requests         r   ListDeploymentsClient.ListDeployments   sN     ==`` a L ##  $' r   c                 N    U R                   R                  UR                  S5      $ )zAConverts an Operation to a Resource to use with `waiter.WaitFor`.z-networksecurity.projects.locations.operations)r,   ParseRelativeNamerF   )r.   	operations     r   GetOperationRefClient.GetOperationRef   s%      22G r   TiX  )secondsc           	      
   U(       a,  [         R                  " U R                  U R                  5      nO [         R                  " U R                  5      n[         R
                  " UUU[        UR                  5       5      S-  S9$ )a  Waits for an operation to complete.

Polls the Network Security Operation service until the operation completes,
fails, or max_wait_seconds elapses.

Args:
  operation_ref: A Resource created by GetOperationRef describing the
    Operation.
  message: The message to display to the user while they wait.
  has_result: If True, the function will return the target of the operation
    (the Intercept Deployment) when it completes. If False, nothing will be
    returned (useful for Delete operations).
  max_wait: The time to wait for the operation to succeed before timing out.

Returns:
  If has_result = True, an Intercept Deployment entity.
  Otherwise, None.
i  )max_wait_ms)r   CloudOperationPollerr'   r)   CloudOperationPollerNoResourcesWaitForinttotal_seconds)r.   operation_refmessage
has_resultmax_waitpollers         r   WaitForOperationClient.WaitForOperation   sp    2 **

"
"D$;$;f 55d6M6MNf>>..01D8	 r   )r%   r'   r)   r,   r*   )NN)NNN)__name__
__module____qualname____firstlineno____doc__r/   rB   rJ   rU   r[   rj   ro   datetime	timedeltar~   __static_attributes__ r   r   r"   r"   9   sR    
$ );V;:@5 =A  !!#.%r   r"   )r   
__future__r   r   r   r   apitools.base.pyr   googlecloudsdk.api_lib.utilr   r   googlecloudsdk.callioper	   googlecloudsdk.corer
   ReleaseTrackALPHABETAGAr   r   r   r   r   r   r"   r   r   r   <module>r      s    P &  '  ' , . ( ) 	ZI$ 
 	 %)$5$5$:$: 8
 %)$5$5$:$: 8
 +/*;*;*@*@ >
 !% 1 1 6 6 3g gr   