
    '                     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	)
z1Fault client for Faultinjectiontesting Cloud SDK.    )absolute_import)division)unicode_literals)
list_pager)utilsc                   H    \ rS rSrSrSS jrS rS rS rS r	  SS	 jr
S
rg)FaultsClient   z0Client for faults 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_faults_faults_client)selfr   r   s      4lib/googlecloudsdk/api_lib/fault_injection/faults.py__init__FaultsClient.__init__   s>    =M;;=DKA ? ? ADM++??D    c                 j    U R                   R                  US9nU R                  R                  U5      $ )zDescribe a Fault in the Project/location.

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

Returns:
  Described Fault Resource.
name)r   6FaultinjectiontestingProjectsLocationsFaultsGetRequestr   Get)r   faultdescribe_reqs      r   DescribeFaultsClient.Describe!   s=     	LL 	M 	
 
 ""<00r   c                 j    U R                   R                  US9nU R                  R                  U5      $ )zDelete a fault in the Project/location.

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

Returns:
  Empty Response Message.
r   )r   9FaultinjectiontestingProjectsLocationsFaultsDeleteRequestr   Delete)r   r   
delete_reqs      r   r#   FaultsClient.Delete1   s=     	OO 	P 	
 
 %%j11r   c                 f    [         R                  " XU5      nU R                  R                  U5      $ )zCreate a fault in the Project/location.

Args:
  fault: str, the name for the fault being created
  faultconfig: file, the file which contains fault config
  parent: parent for fault resource

Returns:
  Fault.
)r   ParseCreateFaultFromYamlr   Create)r   r   faultconfigparent
create_reqs        r   r(   FaultsClient.CreateA   s2      88F
J %%j11r   c                 d    [         R                  " X5      nU R                  R                  U5      $ )zUpdate a fault in the Project/location.

Args:
  fault: str, the name for the fault being created
  faultconfig: file, the file which contains fault config

Returns:
  Fault.
)r   ParseUpdateFaultFromYamlr   Patch)r   r   r)   	patch_reqs       r   UpdateFaultsClient.UpdateR   s+     77KI$$Y//r   c           	      z    U R                   R                  US9n[        R                  " U R                  USUUSS9$ )a=  List Faults 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 Faults.
)r*   faultspageSize)field
batch_sizelimitbatch_size_attribute)r   7FaultinjectiontestingProjectsLocationsFaultsListRequestr   YieldFromListr   )r   r*   r8   	page_sizelist_reqs        r   ListFaultsClient.List`   sQ    $ 	MM 	N 	
 
 ##' r   )r   r   r   )NN)Nd   )__name__
__module____qualname____firstlineno____doc__r   r   r#   r(   r1   r>   __static_attributes__ r   r   r	   r	      s,    8@
1 2 2"0" 	r   r	   N)rE   
__future__r   r   r   apitools.base.pyr   &googlecloudsdk.api_lib.fault_injectionr   r   objectr	   rG   r   r   <module>rL      s'    8 &  ' ' Id6 dr   