
    ,                     N    d Z ddlmZ ddlmZ ddlmZ ddlmZ  G d de      Zy)	z5Overwatch Object to run all commands under overwatch.    )absolute_import)division)unicode_literals)	instancesc                   N    e Zd ZdZd ZddZd Zd Zd Zd Z	d	 Z
d
 Zd Zd Zy)SLZOverwatchClientz/Implements overwatch commands using API Client.c                     t        j                         | _        t        j                         | _        t        j
                         | _        t        j                         | _        y )N)	r   get_overwatch_message	_messagesget_overwatch_service_overwatch_serviceget_organization_service_organization_serviceget_operations_service_operation_service)selfs    9lib/googlecloudsdk/api_lib/scc/slz_overwatch/overwatch.py__init__zSLZOverwatchClient.__init__   sE    446DN'==?D!*!C!C!ED'>>@D    Nc                     |t        |      }| j                  j                  |||      }| j                  j	                  |      }|S )a  Implements method for the overwatch command `list`.

    Args:
      parent: The organization ID and location in the format
        organizations/<ORG_ID>/locations/<LOCATION-ID>.
      page_size: The entries required at a time.
      page_token: The page token for the specific page. If the page_token is
        empty, then it indicates to return results from the start.

    Returns:
      response: The response from the List method of API client.
    )parentpageSize	pageToken)intr   >SecuredlandingzoneOrganizationsLocationsOverwatchesListRequestr   List)r   r   	page_size
page_tokenrequestresponses         r   r   zSLZOverwatchClient.List!   sP     i.inn[[	Z \ AG&&++G4HOr   c                 t    | j                   j                  |      }| j                  j                  |      }|S )a#  Implements method for the overwatch command `get`.

    Args:
      overwatch_path: The complete overwatch path. Format:
        organizations/<ORG_ID>/locations/<LOCATION_ID>/overwatches/<OVERWATCH_ID>.

    Returns:
      response: The json response from the Get method of API client.
    name)r   =SecuredlandingzoneOrganizationsLocationsOverwatchesGetRequestr   Getr   overwatch_pathr   r    s       r   r%   zSLZOverwatchClient.Get5   s<     nnZZ [ G&&**73HOr   c                 t    | j                   j                  |      }| j                  j                  |      }|S )a)  Implements method for the overwatch command `delete`.

    Args:
      overwatch_path: The complete overwatch path. Format:
        organizations/<ORG_ID>/locations/<LOCATION_ID>/overwatches/<OVERWATCH_ID>.

    Returns:
      response: The json response from the Delete method of API client.
    r"   )r   @SecuredlandingzoneOrganizationsLocationsOverwatchesDeleteRequestr   Deleter&   s       r   r*   zSLZOverwatchClient.DeleteD   s<     nn]] ^ G&&--g6HOr   c                 t   | j                   j                  |j                         | j                   j                  j                  j                  |      }| j                   j                  |j                         j                         ||j                               }| j                  j                  |      }|S )a  Implements method for the overwatch command `create`.

    Args:
      overwatch: The overwatch resource.
      blueprint_plan: Base64 encoded blueprint plan message.

    Returns:
      response: The json response from the Create method of API client.
    )r#   stateplanData)r   ,googleCloudSecuredlandingzoneV1betaOverwatchoverwatchId)
r   ,GoogleCloudSecuredlandingzoneV1betaOverwatchRelativeNameStateValueValuesEnumACTIVE@SecuredlandingzoneOrganizationsLocationsOverwatchesCreateRequestParentNamer   Create)r   	overwatchblueprint_planreq_overwatchr   r    s         r   r7   zSLZOverwatchClient.CreateS   s     NNOO##%nnII		ff P !M nn]]!..05BNN$ ^ &G &&--g6HOr   c                 t    | j                   j                  |      }| j                  j                  |      }|S )a+  Implements method for the overwatch command `suspend`.

    Args:
      overwatch_path: The complete overwatch path. Format:
        organizations/<ORG_ID>/locations/<LOCATION_ID>/overwatches/<OVERWATCH_ID>.

    Returns:
      response: The json response from the Suspend method of API client.
    r"   )r   ASecuredlandingzoneOrganizationsLocationsOverwatchesSuspendRequestr   Suspendr&   s       r   r=   zSLZOverwatchClient.Suspendj   s<     nn^^ _ G&&..w7HOr   c                 t    | j                   j                  |      }| j                  j                  |      }|S )a-  Implements method for the overwatch command `activate`.

    Args:
      overwatch_path: The complete overwatch path. Format:
        organizations/<ORG_ID>/locations/<LOCATION_ID>/overwatches/<OVERWATCH_ID>.

    Returns:
      response: The json response from the Activate method of API client.
    r"   )r   BSecuredlandingzoneOrganizationsLocationsOverwatchesActivateRequestr   Activater&   s       r   r@   zSLZOverwatchClient.Activatey   s<     nn__ ` G&&//8HOr   c                     | j                   j                  ||      }| j                   j                  |||      }| j                  j	                  |      }|S )a  Implements method for the overwatch command `update`.

    Args:
      overwatch_path: The complete overwatch path. Format:
        organizations/<ORG_ID>/locations/<LOCATION_ID>/overwatches/<OVERWATCH_ID>.
      blueprint_plan: Base64 encoded blueprint plan message.
      update_mask: The name of the field that will be updated.

    Returns:
      response: The json response from the Update method of API client.
    )r#   r-   )r#   r.   
updateMask)r   r0   ?SecuredlandingzoneOrganizationsLocationsOverwatchesPatchRequestr   Patch)r   r'   r9   update_maskr8   r   r    s          r   rD   zSLZOverwatchClient.Patch   sc     KKn L 6Inn\\5> ]  G &&,,W5HOr   c                 t    | j                   j                  |      }| j                  j                  |      }|S )a   Implements method for the overwatch command `enable`.

    Args:
      parent: The parent where overwatch service needs to be enabled. Format:
        organizations/<ORG_ID>/locations/<LOCATION_ID>

    Returns:
      response: The json response from the Enable method of API client.
    )organization)r   >SecuredlandingzoneOrganizationsLocationsEnableOverwatchRequestr   EnableOverwatch)r   r   r   r    s       r   EnablezSLZOverwatchClient.Enable   s<     nn[[ \ G))99'BHOr   c                 t    | j                   j                  |      }| j                  j                  |      }|S )aA  Implements method for the overwatch command  `operation`.

    Args:
      operation_id: The operation ID of google.lonrunning.operation. Format:
        organizations/<ORG_ID>/locations/<LOCATION_ID>/operations/<OPERATION_ID>.

    Returns:
      response: The json response from the Operation method of API client.
    r"   )r   <SecuredlandingzoneOrganizationsLocationsOperationsGetRequestr   r%   )r   operation_idr   r    s       r   	OperationzSLZOverwatchClient.Operation   s<     nnYY Z G&&**73HOr   )NN)__name__
__module____qualname____doc__r   r   r%   r*   r7   r=   r@   rD   rJ   rN    r   r   r   r      s8    7A(.*r   r   N)	rR   
__future__r   r   r   ,googlecloudsdk.command_lib.scc.slz_overwatchr   objectr   rS   r   r   <module>rW      s$    < &  ' Ba ar   