
                         x    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	 Z G d
 de      Zy)z5Utilities Assured Workloads API, Workloads Endpoints.    )absolute_import)division)unicode_literals)
list_pager)message_util)util)	resourcesc                 x    t         j                  j                  | j                  d      }|j	                         S )Nz=assuredworkloads.organizations.locations.workloads.violations)
collection)r	   REGISTRYParseRelativeNamenameSelfLink)resource	violations     0lib/googlecloudsdk/api_lib/assured/violations.pyGetViolationURIr      s8      22mmP 3 ) 
			    c                   0    e Zd ZdZddZddZd Z	 d	dZy)
ViolationsClientz/Client for Violations in Assured Workloads API.c                     t        j                  ||      | _        t        j                  |      | _        || _        | j                  j                  | _        y N)r   GetClientInstanceclientGetMessagesModulemessages_release_track,organizations_locations_workloads_violations_service)selfrelease_trackno_https      r   __init__zViolationsClient.__init__&   sA    ((@DK**=9DM'DKKLLDMr   Nc                     | j                   j                  ||      }t        j                  | j                  |d||d      S )a%  List all Assured Workloads violations belonging to the given workload.

    Args:
      parent: str, the parent workload of the Assured Workloads Violations to be
        listed, in the form:
        organizations/{ORG_ID}/locations/{LOCATION}/workloads/{WORKLOAD}.
      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:
      A list of all Assured Workloads violations belonging to a given workload.
    )parentpageSize
violationsN)field
batch_sizelimitbatch_size_attribute)r   DAssuredworkloadsOrganizationsLocationsWorkloadsViolationsListRequestr   YieldFromListr   )r    r%   r*   	page_sizelist_reqs        r   ListzViolationsClient.List,   sN     }}aa	 b H ##! r   c                     | j                   j                  |      }| j                  j                  j	                  |      S )aQ  Describe an existing Assured Workloads compliance violation.

    Args:
      name: str, the name for the Assured Workloads Violation being described in
        the form:
        organizations/{ORG_ID}/locations/{LOCATION}/workloads/{WORKLOAD_ID}/violations/{VIOLATION_ID}.

    Returns:
      Specified Assured Workloads Violation.
    )r   )r   CAssuredworkloadsOrganizationsLocationsWorkloadsViolationsGetRequestr   r   Get)r    r   describe_reqs      r   DescribezViolationsClient.DescribeF   sC     ==dd e L ;;CCGG r   c                     t        j                  |||| j                        }| j                  j                  j                  |      S )a  Acknowledge an existing Assured Workloads compliance violation.

    Args:
      name: str, the name for the Assured Workloads violation being described in
        the form:
        organizations/{ORG_ID}/locations/{LOCATION}/workloads/{WORKLOAD_ID}/violations/{VIOLATION_ID}.
      comment: str, the business justification which the user wants to add while
        acknowledging a violation.
      acknowledge_type: str, the acknowledge type for specified violation, which
        is one of: SINGLE_VIOLATION - to acknowledge specified violation,
        EXISTING_CHILD_RESOURCE_VIOLATIONS - to acknowledge specified org policy
        violation and all associated child resource violations.

    Returns:
      Specified Assured Workloads Violation.
    )r   CreateAcknowledgeRequestr   r   r   Acknowledge)r    r   commentacknowledge_typeacknowledgement_reqs        r   r8   zViolationsClient.AcknowledgeX   sG    , '??g')<)< ;;CCOO r   )F)Nd   r   )__name__
__module____qualname____doc__r#   r0   r5   r8    r   r   r   r   #   s    7M4, 	r   r   N)r@   
__future__r   r   r   apitools.base.pyr   googlecloudsdk.api_lib.assuredr   r   googlecloudsdk.corer	   r   objectr   rA   r   r   <module>rG      s2    < &  ' ' 7 / )Pv Pr   