
    .                         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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.    )absolute_import)division)unicode_literals)
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   r;   EnrollmentClientV1.Create6   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,   .EventarcProjectsLocationsEnrollmentsGetRequestr9   r.   Get)r/   r<   get_reqs      r   rD   EnrollmentClientV1.GetL   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.
)r4   pageSizer   rH   )servicerequestfieldlimit
batch_sizebatch_size_attribute)r,   /EventarcProjectsLocationsEnrollmentsListRequestr9   r   YieldFromListr.   )r/   location_refrL   	page_sizelist_reqs        r   ListEnrollmentClientV1.ListZ   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,   0EventarcProjectsLocationsEnrollmentsPatchRequestr9   r.   Patch)r/   r<   r=   update_mask	patch_reqs        r   rY   EnrollmentClientV1.Patchr   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.
rB   )r,   1EventarcProjectsLocationsEnrollmentsDeleteRequestr9   r.   Delete)r/   r<   
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,   
Enrollmentr9   )r/   r<   	cel_matchmessage_bus_refdestination_refrg   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.
rd   rf   rg   z*Must specify at least one field to update.,)appendr   join)r/   ri   rf   rg   rZ   s        r   BuildUpdateMask"EnrollmentClientV1.BuildUpdateMask   sZ     K$'""#OPP88K  r   c                 B    U R                   R                  R                  $ )N)r,   rh   LabelsValue)r/   s    r   LabelsValueClass#EnrollmentClientV1.LabelsValueClass   s    >>$$000r   )r,   r.   )F)r   r   r   r   r   r'   r;   rD   rT   rY   r_   rl   rr   rv   r   __classcell__)r1   s   @r   r"   r"   (   s8    N	:,,&0*&, !61 1r   r"   N)r   
__future__r   r   r   apitools.base.pyr   googlecloudsdk.api_lib.eventarcr   r   googlecloudsdk.api_lib.utilr	   googlecloudsdk.corer
   r   Errorr   r    EventarcClientBaser"   r   r   r   <module>r      sR    . &  ' ' 0 2 , * )CZ-- C X100 X1r   