
                             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	\	R                  5      rS
 r " S S\R                  5      rg)z'Utilities for Eventarc Enrollments API.    )
list_pager)base)common)apis)
exceptions)	resourcesc                       \ rS rSrSrSrg)NoFieldsSpecifiedError   z:Error when no fields were specified for a Patch operation. N)__name__
__module____qualname____firstlineno____doc____static_attributes__r       2lib/googlecloudsdk/api_lib/eventarc/enrollments.pyr
   r
      s    Br   r
   c                 r    [         R                  R                  U R                  SS9nUR	                  5       $ )Nz'eventarc.projects.locations.enrollments)
collection)r   REGISTRYParseRelativeNamenameSelfLink)resourceenrollmentss     r   GetEnrollmentURIr      s8    ""44mm I 5 + 
			r   c                   `   ^  \ rS rSrSrU 4S jrSS jrS rS rS r	S r
S	 rS
 rS rSrU =r$ )EnrollmentClientV1%   zFEnrollment Client for interaction with v1 of Eventarc Enrollments API.c                   > [         [        U ]  [        R                  [        R
                  S5        [        R                  " [        R                  [        R
                  5      nUR                  U l	        UR                  U l        g )N
enrollment)superr   __init__r   API_NAMEAPI_VERSION_1r   GetClientInstanceMESSAGES_MODULE	_messagesprojects_locations_enrollments_service)selfclient	__class__s     r   r$   EnrollmentClientV1.__init__(   s\    	
d,--|
 ##FOOV5I5IJF++DN99DMr   c                     U R                   R                  UR                  5       R                  5       UUR	                  5       US9nU R
                  R                  U5      $ )aR  Creates a new Enrollment.

Args:
  enrollment_ref: Resource, the Enrollment to create.
  enrollment_message: Enrollment, the enrollment message that holds
    enrollment's name, cel_match, message_bus, destination, etc.
  dry_run: If set, the changes will not be committed, only validated

Returns:
  A long-running operation for create.
)parentr"   enrollmentIdvalidateOnly)r)   1EventarcProjectsLocationsEnrollmentsCreateRequestParentRelativeNameNamer+   Create)r,   enrollment_refenrollment_messagedry_run
create_reqs        r   r8   EnrollmentClientV1.Create3   s_     	HH!((*779)',,. 	 	I 	
  ==
++r   c                     U R                   R                  UR                  5       S9nU R                  R	                  U5      $ )z}Gets the requested Enrollment.

Args:
  enrollment_ref: Resource, the Enrollment to get.

Returns:
  The Enrollment message.
r   )r)   .EventarcProjectsLocationsEnrollmentsGetRequestr6   r+   Get)r,   r9   get_reqs      r   rA   EnrollmentClientV1.GetI   sA     nnKK((* L G ==W%%r   c           	          U R                   R                  UR                  5       US9n[        R                  " U R
                  USUUSS9$ )aS  List available enrollments in location.

Args:
  location_ref: Resource, the location to list Enrollments in.
  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 generator of Enrollments in the location.
)r1   pageSizer   rE   )servicerequestfieldlimit
batch_sizebatch_size_attribute)r)   /EventarcProjectsLocationsEnrollmentsListRequestr6   r   YieldFromListr+   )r,   location_refrI   	page_sizelist_reqs        r   ListEnrollmentClientV1.ListW   sW     ~~MM((*Y N H ##' r   c                     U R                   R                  UR                  5       UUS9nU R                  R	                  U5      $ )a`  Updates the specified Enrollment.

Args:
  enrollment_ref: Resource, the Enrollment to update.
  enrollment_message: Enrollment, the enrollment message that holds
    enrollment's name, cel_match, message_bus, destination, etc.
  update_mask: str, a comma-separated list of Enrollment fields to update.

Returns:
  A long-running operation for update.
)r   r"   
updateMask)r)   0EventarcProjectsLocationsEnrollmentsPatchRequestr6   r+   Patch)r,   r9   r:   update_mask	patch_reqs        r   rV   EnrollmentClientV1.Patcho   sG     OO((*% P I
 ==y))r   c                     U R                   R                  UR                  5       S9nU R                  R	                  U5      $ )zDeletes the specified Enrollment.

Args:
  enrollment_ref: Resource, the Enrollment to delete.

Returns:
  A long-running operation for delete.
r?   )r)   1EventarcProjectsLocationsEnrollmentsDeleteRequestr6   r+   Delete)r,   r9   
delete_reqs      r   r\   EnrollmentClientV1.Delete   sD     	HH,,. 	I 	
 
 ==
++r   c                     U R                   R                  UR                  5       UUb  UR                  5       OSUb  UR                  5       US9$ SUS9$ )N )r   celMatch
messageBusdestinationlabels)r)   
Enrollmentr6   )r,   r9   	cel_matchmessage_bus_refdestination_refrd   s         r   BuildEnrollment"EnrollmentClientV1.BuildEnrollment   sv     >>$$((*& #//1& $002  % 
 
  % 
 
r   c                     / nU(       a  UR                  S5        U(       a  UR                  S5        U(       a  UR                  S5        U(       d  [        S5      eSR                  U5      $ )a<  Builds an update mask for updating a enrollment.

Args:
  cel_match: bool, whether to update the cel_match.
  destination: bool, whether to update the destination.
  labels: bool, whether to update the labels.

Returns:
  The update mask as a string.


Raises:
  NoFieldsSpecifiedError: No fields are being updated.
ra   rc   rd   z*Must specify at least one field to update.,)appendr
   join)r,   rf   rc   rd   rW   s        r   BuildUpdateMask"EnrollmentClientV1.BuildUpdateMask   sZ     K$'""#OPP88K  r   c                 B    U R                   R                  R                  $ )N)r)   re   LabelsValue)r,   s    r   LabelsValueClass#EnrollmentClientV1.LabelsValueClass   s    >>$$000r   )r)   r+   )F)r   r   r   r   r   r$   r8   rA   rQ   rV   r\   ri   ro   rs   r   __classcell__)r.   s   @r   r   r   %   s8    N	:,,&0*&, !61 1r   r   N)r   apitools.base.pyr   googlecloudsdk.api_lib.eventarcr   r   googlecloudsdk.api_lib.utilr   googlecloudsdk.corer   r   Errorr
   r   EventarcClientBaser   r   r   r   <module>r|      sK    . ( 0 2 , * )CZ-- C X100 X1r   