
                            d Z ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlm	Z	 ddl
mZ dd	lmZ  e	j                  e	j                  j                         e	j"                   G d
 de	j$                                      Zy)zPCommand for creating a Cloud Security Command Center RemediationIntent resource.    )absolute_import)division)print_function)unicode_literals)sps_api)base)flags)logc                   0    e Zd ZdZdddZed        Zd Zy)Createz&Creates a remediation intent resource.z
        Create a Cloud Security Command Center (SCC)
        RemediationIntent resource.
        Created resource is returned as the response of the command.a  
          Sample usage:
          Create a manual workflow remediation intent resource:
          $ {{command}} scc remediation-intents create --parent=organizations/123456789/locations/global --finding-name=projects/123456789/sources/123456789/locations/global/findings/123456789 --workflow-type=manual

          Create a semi-autonomous workflow remediation intent resource:
          $ {{command}} scc remediation-intents create --parent=organizations/123456789/locations/global --workflow-type=semi-autonomous
          )DESCRIPTIONEXAMPLESc                 r   t         j                  j                  |        t         j                  j                  | d       t        j
                  j                  |        t        j                  j                  |        t        j                  j                  |        | j                  j                  d       y )NFyaml)
r   
ASYNC_FLAGAddToParser
SetDefaultr	   PARENT_NAME_FLAGFINDING_NAME_FLAGWORKFLOW_TYPE_FLAGdisplay_info	AddFormat)parsers    -lib/surface/scc/remediation_intents/create.pyArgszCreate.Args1   sx    OO'OOvu-	&&v.	''/	((0
!!&)    c                 (   t        j                  t        j                  j                        }t        j
                  t        j                  j                        }|j                  dk(  r!|j                  j                  j                  }nP|j                  dk(  r!|j                  j                  j                  }n |j                  j                  j                  }|j                  |j                  |j                  |j                  |            }|j                  j!                  |      }|j"                  }|j$                  r"t&        j(                  j+                  d|       |S t        j,                  t        j.                  |      dd	      S )
a	  The main function which is called when the user runs this command.

    Args:
      args: an argparse namespace. All the arguments that were provided to this
        command invocation.
    Returns:
      Operation resource containing either resource or error.
    zsemi-autonomousmanual)findingNameworkflowType)parentcreateRemediationIntentRequest)requestz9Check for operation completion status using operation ID:z,Waiting for remediation intent to be createdT)operation_refmessage
has_result)r   GetClientInstancer   ReleaseTrackALPHAGetMessagesModuleworkflow_typeCreateRemediationIntentRequestWorkflowTypeValueValuesEnumWORKFLOW_TYPE_SEMI_AUTONOMOUSWORKFLOW_TYPE_MANUALWORKFLOW_TYPE_UNSPECIFIEDDSecuritypostureOrganizationsLocationsRemediationIntentsCreateRequestr!   finding_name*organizations_locations_remediationIntentsr   nameasync_r
   statusPrintWaitForOperationGetOperationsRef)selfargsclientmessagesr+   r#   	operationoperation_ids           r   Runz
Create.Run:   sf    &&t'8'8'>'>?F(():):)@)@AH ..

1
1
M
M
k
k  
		x	'

1
1
M
M
b
b 
 
1
1
M
M
g
g 
 [[{{'/'N'N))& (O (
 \ G AAHH I I >>L{{	jj
E
 %%00>@ r   N)__name__
__module____qualname____doc__detailed_helpstaticmethodr   r@    r   r   r   r      s2     /H
-  * *3r   r   N)rD   
__future__r   r   r   r   .googlecloudsdk.api_lib.scc.remediation_intentsr   googlecloudsdk.callioper   2googlecloudsdk.command_lib.scc.remediation_intentsr	   googlecloudsdk.corer
   ReleaseTracksr(   r)   UniverseCompatibleCreateCommandr   rG   r   r   <module>rP      sn    W &  % ' B ( D # D%%++,OT O  -Or   