
                         d    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r
S r " S	 S
\5      rg)z5Utilities Assured Workloads API, Workloads Endpoints.    )
list_pager)message_util)util)waiter)	resourcesz&Creating Assured Workloads environmentc                 r    [         R                  R                  U R                  SS9nUR	                  5       $ )Nz2assuredworkloads.organizations.locations.workloads
collection)r   REGISTRYParseRelativeNamenameSelfLink)resourceworkloads     /lib/googlecloudsdk/api_lib/assured/workloads.pyGetWorkloadURIr      s8    11mmE 2 ( 
			    c                   V    \ rS rSrSrSS jrSS jrS rS rS r	S	 r
S
 rS rS rSrg)WorkloadsClient$   z.Client for Workloads in Assured Workloads API.c                     [         R                  " X5      U l        [         R                  " U5      U l        Xl        U R                  R                  U l        g )N)r   GetClientInstanceclientGetMessagesModulemessages_release_track!organizations_locations_workloads_service)selfrelease_trackno_https      r   __init__WorkloadsClient.__init__'   s=    ((@DK**=9DM'KKAADMr   Nc           	      z    U R                   R                  XS9n[        R                  " U R                  USUUSS9$ )a  List all Assured Workloads environments belonging to a given parent organization.

Args:
  parent: str, the parent organization of the Assured Workloads environment
    to be listed, in the form: organizations/{ORG_ID}/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:
  A list of all Assured Workloads environments belonging to a given parent
  organization.
)parentpageSize	workloadsN)field
batch_sizelimitbatch_size_attribute)r   :AssuredworkloadsOrganizationsLocationsWorkloadsListRequestr   YieldFromListr   )r   r%   r*   	page_sizelist_reqs        r   ListWorkloadsClient.List-   sL     }}WW X H ##! r   c                     [         R                  " X!X0R                  5      nU R                  R                  R                  U5      nU R                  U[        5      $ )a  Create a new Assured Workloads environment in the parent organization.

Args:
  parent: str, the parent organization of the Assured Workloads environment
    to be created, in the form: organizations/{ORG_ID}/locations/{LOCATION}.
  external_id: str, the identifier that identifies this Assured Workloads
    environment externally.
  workload: Workload, new Assured Workloads environment containing the
    values to be used.

Returns:
  The created Assured Workloads environment resource.
)r   CreateCreateRequestr   r   r   CreateWaitForOperation%WORKLOAD_CREATION_IN_PROGRESS_MESSAGE)r   r%   external_idr   
create_reqops         r   r4   WorkloadsClient.CreateG   sO     11X':':J 
	6	6	=	=j	IB  %JKKr   c                 ~    U R                   R                  XS9nU R                  R                  R	                  U5      $ )a;  Delete an existing Assured Workloads environment.

Args:
  name: str, name of the Assured Workloads environtment to be deleted, in
    the form:
    organization/{ORG_ID}/locations/{LOCATION}/workloads/{WORKLOAD_ID}
  etag: str, the etag string acquired by reading the Workload.

Returns:
  Empty response message.
)r   etag)r   <AssuredworkloadsOrganizationsLocationsWorkloadsDeleteRequestr   r   Delete)r   r   r<   
delete_reqs       r   r>   WorkloadsClient.Delete[   s>     [[ \ J ;;88??
KKr   c                 ~    U R                   R                  US9nU R                  R                  R	                  U5      $ )a  Describe an existing Assured Workloads environment.

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

Returns:
  Specified Assured Workloads resource.
r   )r   9AssuredworkloadsOrganizationsLocationsWorkloadsGetRequestr   r   Get)r   r   describe_reqs      r   DescribeWorkloadsClient.Describel   sA     	OO 	P 	
 
 ;;88<<\JJr   c                     [         R                  " XX0R                  5      nU R                  R                  R                  U5      $ )aa  Update the configuration values of an existing Assured Workloads environment.

Args:
  workload: googleCloudAssuredworkloadsV1beta1Workload, new Assured
    Workloads environment containing the new configuration values to be
    used.
  name: str, the name for the Assured Workloads environment being updated in
    the form:
    organizations/{ORG_ID}/locations/{LOCATION}/workloads/{WORKLOAD_ID}.
  update_mask: str, list of the fields to be updated, for example,
    workload.display_name,workload.labels,workload.violation_notifications_enabled

Returns:
  Updated Assured Workloads environment resource.
)r   CreateUpdateRequestr   r   r   Patch)r   r   r   update_mask
update_reqs        r   UpdateWorkloadsClient.Update~   s<    " 11%8%8J ;;88>>zJJr   c                 ~    U R                   R                  US9nU R                  R                  R	                  U5      $ )a  Enable resource violation monitoring for a workload.

Args:
  name: str, name of the Assured Workloads for which Resource Monitoring is
    enabled, in the form:
    organization/{ORG_ID}/locations/{LOCATION}/workloads/{WORKLOAD_ID}

Returns:
  Empty response message.
rB   )r   NAssuredworkloadsOrganizationsLocationsWorkloadsEnableResourceMonitoringRequestr   r   EnableResourceMonitoring)r   r   
enable_reqs      r   rQ   (WorkloadsClient.EnableResourceMonitoring   sC     mm n J 	55NN	
r   c                     U R                  UR                  5      n[        R                  " U R                  R
                  U R                  R                  5      n[        R                  " XCU5      $ )a'  Waits for the given google.longrunning.Operation to complete.

Args:
  operation: The operation to poll.
  progress_message: String to display for default progress_tracker.

Raises:
  apitools.base.py.HttpError: if the request returns an HTTP error

Returns:
  The created Environment resource.
)GetOperationResourcer   r   CloudOperationPollerr   r   "organizations_locations_operationsWaitFor)r   	operationprogress_messageoperation_refpollers        r   r5    WorkloadsClient.WaitForOperation   sV     --inn=M((5566F >>&1ABBr   c                 >    [         R                  R                  USS9$ )Nz3assuredworkloads.organizations.locations.operationsr	   )r   r   r   )r   r   s     r   rU   $WorkloadsClient.GetOperationResource   s&    //N 0  r   )r   r   r   r   )F)Nd   )__name__
__module____qualname____firstlineno____doc__r"   r0   r4   r>   rF   rM   rQ   r5   rU   __static_attributes__ r   r   r   r   $   s8    6B4L(L"K$K,(C(r   r   N)re   apitools.base.pyr   googlecloudsdk.api_lib.assuredr   r   googlecloudsdk.api_lib.utilr   googlecloudsdk.corer   r6   r   objectr   rg   r   r   <module>rm      s7    < ( 7 / . ) )Q %[f [r   