
                         Z    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\
5      rg	)
z0Jobs client for Faultinjectiontesting Cloud SDK.    )absolute_import)division)unicode_literals)
list_pager)utilsc                   B    \ rS rSrSrS
S jrS r  SS jrS rS r	S	r
g)
JobsClient   z.Client for Jobs in Faultinjection Testing API.Nc                     U=(       d    [         R                  " 5       U l        U=(       d    [         R                  " 5       U l        U R                  R
                  U l        g )N)api_lib_utilsGetClientInstanceclientGetMessagesModulemessagesprojects_locations_jobs_jobs_client)selfr   r   s      2lib/googlecloudsdk/api_lib/fault_injection/jobs.py__init__JobsClient.__init__   s>    =M;;=DKA ? ? ADM;;D    c                 j    U R                   R                  US9nU R                  R                  U5      $ )zDescribe a job in the Project/location.

Args:
  job: str, the name for the job being described.

Returns:
  Described Job Resource.
name)r   4FaultinjectiontestingProjectsLocationsJobsGetRequestr   Get)r   jobdescribe_reqs      r   DescribeJobsClient.Describe!   s=     	JJ 	K 	
 
   ..r   c           	      z    U R                   R                  US9n[        R                  " U R                  USUUSS9$ )a9  List Jobs in the Projects/Location.

Args:
  parent: str, projects/{projectId}/locations/{location}
  limit: int or None, the total number of results to return.
  page_size: int, the number of entries in each batch (affects requests
    made, but not the yielded results).

Returns:
  Generator of matching jobs.
)parentjobspageSize)field
batch_sizelimitbatch_size_attribute)r   5FaultinjectiontestingProjectsLocationsJobsListRequestr   YieldFromListr   )r   r"   r'   	page_sizelist_reqs        r   ListJobsClient.List1   sQ    $ 	KK 	L 	
 
 ##' r   c                    / nU H+  nUR                  U R                  R                  US95        M-     U R                  R                  X&S9nU R                  R	                  UUUUS9n	U R
                  R                  U	5      $ )a  Create a job in the Project/location.

Args:
  job_id: str, the name for the job being created
  experiment_id: str, name of the experiment
  fault_targets: targets for the faults
  dry_run: Boolean value for dry-run
  parent: parent for fault resource

Returns:
  Job.
)service)
experimentfaultTargets)jobIdr   validateOnlyr"   )appendr   FaultInjectionTargetMatcherJob7FaultinjectiontestingProjectsLocationsJobsCreateRequestr   Create)
r   job_idexperiment_idfault_targetsdry_runr"   targetsfault_targetr   
create_reqs
             r   r9   JobsClient.CreateP   s     G%nn
--
3
3L
3
I &
 --

}

KCMM 	 	N 	
  ##J//r   c                 j    U R                   R                  US9nU R                  R                  U5      $ )zDelete a Job in the Project/location.

Args:
  job: str, the name for the job being deleted

Returns:
  Empty Response Message.
r   )r   7FaultinjectiontestingProjectsLocationsJobsDeleteRequestr   Delete)r   r   
delete_reqs      r   rD   JobsClient.Deletep   s=     	MM 	N 	
 
 ##J//r   )r   r   r   )NN)Nd   )__name__
__module____qualname____firstlineno____doc__r   r   r-   r9   rD   __static_attributes__ r   r   r	   r	      s'    6<
/& 	>0@0r   r	   N)rL   
__future__r   r   r   apitools.base.pyr   &googlecloudsdk.api_lib.fault_injectionr   r   objectr	   rN   r   r   <module>rS      s'    7 &  ' ' Ie0 e0r   