
                         p    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K	J
r
  SSKJr   " S	 S
5      rg)zHModule containing the extended wrappers for Remediation Intents service.    )absolute_import)division)unicode_literals)Any)sps_api)base)errorsc                       \ rS rSrSr\R                  R                  4S\4S jjr	S\
4S jrSS jrS	\S
\S\
S\
4S jrSrg)ExtendedSPSClient   aw  Extended client for the SPS Service (wrappers for specific API calls).

Attributes:
  release_track: The Gcloud release track to use, like ALPHA, GA.
  org_id: The organization ID for which the API methods are called.
  api_version: The API version to use like v1alpha, main etc.
  client: The client for the SPS Service.
  messages: The messages module for the SPS Service.
org_idc                     X l         Xl        [        R                  R	                  U5      U l        [        R                  " U5      U l        [        R                  " U5      U l	        g)zInitializes the ExtendedSPSClient.

Args:
  org_id: The organization ID for which the API methods are called.
  release_track: The release track to use for the API version.
N)
release_trackr   r   VERSION_MAPgetapi_versionGetClientInstanceclientGetMessagesModulemessages)selfr   r   s      Flib/googlecloudsdk/api_lib/scc/remediation_intents/extended_service.py__init__ExtendedSPSClient.__init__'   sL     'K**..}=D++M:DK--m<DM    returnc                 J   U R                   R                  SU R                   S3SS9n U R                  R                  R                  U5      nUR                  nUb  [        U5      S:  a  gUS   $ ! [         a%  n[        R                  " S[        U5      5      eSnAff = f)	aN  Fetches a Remediation Intent resource in ENQUEUED state in given org.

Returns:
  A Remediation Intent resource in ENQUEUED state for the given org. If no
  such resource is found, returns None.
  Return format is of class (securityposture.messages.RemediationIntent).

Raises:
  APICallError: An error while calling the SPS Service.
organizations//locations/globalz#state : REMEDIATION_INTENT_ENQUEUED)parentfilterListN   r   )r   BSecuritypostureOrganizationsLocationsRemediationIntentsListRequestr   r   *organizations_locations_remediationIntentsr"   	Exceptionr	   APICallErrorstrremediationIntentslen)r   requestresponseeremediation_intentss        r   !fetch_enqueued_remediation_intent3ExtendedSPSClient.fetch_enqueued_remediation_intent4   s     mm^^},=>4 _ G0
++
@
@
E
Eg
N  #55"c*=&>&Bq!!  0A//0s   %A3 3
B"= BB"Nc                    U R                   R                  SU R                   S3U R                   R                  U R                   R                  R                  R
                  S9S9n U R                  R                  R                  US9n[        R                  " [        R                  " UR                  5      SSS9ng
! [         a%  n[        R                  " S	[!        U5      5      eS
nAff = f)z}Creates a Semi Autonomous type Remediation Intent resource.

Raises:
  APICallError: An error while calling the SPS Service.
r   r   )workflowType)r    createRemediationIntentRequestr+   z,Waiting for remediation intent to be createdToperation_refmessage
has_resultCreateN)r   DSecuritypostureOrganizationsLocationsRemediationIntentsCreateRequestr   CreateRemediationIntentRequestWorkflowTypeValueValuesEnumWORKFLOW_TYPE_SEMI_AUTONOMOUSr   r%   r9   r   WaitForOperationGetOperationsRefnamer&   r	   r'   r(   )r   r+   	operation_r-   s        r   )create_semi_autonomous_remediation_intent;ExtendedSPSClient.create_semi_autonomous_remediation_intentO   s     mm``},=>'+}}'S'SEEaa (T (
 a G
2++HHOO P i 
"
"00@@a
  2#a&112s   )AC 
C0 C++C0ri_nameupdate_maskremediation_intentc                 L   U R                   R                  UUUS9n U R                  R                  R	                  US9n[
        R                  " [
        R                  " UR                  5      SSS9$ ! [         a%  n[        R                  " S[        U5      5      eSnAff = f)a  Updates a Remediation Intent resource.

Args:
  ri_name: The name of the Remediation Intent resource to be updated.
  update_mask: The update mask for the update operation.
  remediation_intent: The updated Remediation Intent resource.

Returns:
  The updated Remediation Intent resource.
  Return format is of class (securityposture.messages.RemediationIntent).

Raises:
  APICallError: An error while calling the SPS Service.
)r@   
updateMaskremediationIntentr4   z,Waiting for remediation intent to be updatedTr5   UpdateN)r   CSecuritypostureOrganizationsLocationsRemediationIntentsPatchRequestr   r%   Patchr   r>   r?   r@   r&   r	   r'   r(   )r   rE   rF   rG   r+   rA   r-   s          r   update_remediation_intent+ExtendedSPSClient.update_remediation_intentg   s    & mm__, ` G

2++HHNN O i %%00@@ 
  2#a&112s   AA4 4
B#> BB#)r   r   r   r   r   )r   N)__name__
__module____qualname____firstlineno____doc__r   ReleaseTrackALPHAr(   r   r   r/   rC   rN   __static_attributes__ r   r   r   r      s^     150A0A0G0G =S =" "620"2"2!$"2 "2 	"2r   r   N)rT   
__future__r   r   r   typingr   .googlecloudsdk.api_lib.scc.remediation_intentsr   googlecloudsdk.callioper   2googlecloudsdk.command_lib.scc.remediation_intentsr	   r   rX   r   r   <module>r^      s,    O &  '  B ( Em2 m2r   