
    (                         S r SSKJr  SSKJr  SrSrSrSr\r	\SS	S
.\SSS
.\SSS
.0r
\	4S jr\	4S jr\	4S jr\	4S jr\	4S jr " S S5      rg)zEssential Contacts API.    )
list_pager)apisessentialcontactsv1alpha1v1beta1v1+googleCloudEssentialcontactsV1alpha1Contact+GoogleCloudEssentialcontactsV1alpha1Contact)
param_namemessage_name*googleCloudEssentialcontactsV1beta1Contact*GoogleCloudEssentialcontactsV1beta1Contact%googleCloudEssentialcontactsV1Contact%GoogleCloudEssentialcontactsV1Contactc                 6    [         R                  " [        U SS9$ )NF)api_nameapi_versionno_http)r   GetClientInstanceAPI_NAMEversions    9lib/googlecloudsdk/api_lib/essential_contacts/contacts.pyr   r   +   s    			We
= =    c                 4    [         R                  " [        U S9$ )N)r   r   )r   GetMessagesModuler   r   s    r   GetMessagesr   0   s    			w	GGr   c                 D    [         U    S   n[        [        U 5      U5      $ )z>Gets the contact message for the specified version of the API.r   )_CONTACT_TYPES_BY_VERSIONgetattrr   )r   versioned_message_types     r   GetContactMessager"   4   s%    4W=nM	W%'=	>>r   c                     [         U    S   $ )Nr   )r   r   s    r   GetContactParamNamer$   :   s    	"7	+L	99r   c                 ,    [        U 5      R                  $ N)r"   9NotificationCategorySubscriptionsValueListEntryValuesEnumr   s    r   "GetContactNotificationCategoryEnumr(   >   s    	
HHIr   c                   T    \ rS rSrSr\4S jrS rS rS r	S r
SS	 jr  SS
 jrSrg)ContactsClientC   z"Client for Essential Contacts API.c                 <   [        U5      U l        U R                  R                  U l        U R                  R                  U l        U R                  R                  U l        U R                  R                  U l	        [        U5      U l        [        U5      U l        g r&   )r   clientMESSAGES_MODULE	_messagesprojects_contacts_projects_servicefolders_contacts_folders_serviceorganizations_contacts_organizations_servicer"   contact_messager$   contact_param_name)selfr   s     r   __init__ContactsClient.__init__F   so    #G,DK[[00DN![[::D KK88D"&++"D"DD,W5D1':Dr   c                    U R                  UUUS9nSXR                  U0nUR                  S5      (       a7  U R                  R                  " S0 UD6nU R
                  R                  U5      $ UR                  S5      (       a7  U R                  R                  " S0 UD6nU R                  R                  U5      $ U R                  R                  " S0 UD6nU R                  R                  U5      $ )a  Creates an Essential Contact.

Args:
  parent_name: the full id of the resource to create the contact for in the
    form of [projects|folders|organizations]/{resourceId}
  email: the contact's email address.
  notification_categories: the categories of notifications this contact
    should receive.
  language_tag: the contact's preferred language to receive communication
    in.

Returns:
  The created contact.
)email!notificationCategorySubscriptionslanguageTagparentfoldersorganizations )r6   r7   
startswithr/   -EssentialcontactsFoldersContactsCreateRequestr3   Create3EssentialcontactsOrganizationsContactsCreateRequestr5   .EssentialcontactsProjectsContactsCreateRequestr1   )r8   parent_namer<   notification_categorieslanguage_tagcontactargs
create_reqs           r   rE   ContactsClient.CreateV   s     ""*A  # "G k#:#:GDDi((>>OO j""))*55o..>>UU j((//
;;NN 
J!!((44r   c                 n   / nU(       a  UR                  S5        U(       a  UR                  S5        SR                  U5      nU R                  UUS9nSUSUU R                  U0nUR	                  S5      (       a7  U R
                  R                  " S	0 UD6nU R                  R                  U5      $ UR	                  S5      (       a7  U R
                  R                  " S	0 UD6nU R                  R                  U5      $ U R
                  R                  " S	0 UD6nU R                  R                  U5      $ )
a  Updates an Essential Contact.

Args:
  contact_name: the full id of the contact to update in the form of
    [projects|folders|organizations]/{resourceId}/contacts/{contactId}
  notification_categories: the categories of notifications this contact
    should receive, or None if not updating notification categories.
  language_tag: the contact's preferred language to receive communication
    in, or None if not updating language.

Returns:
  The updated contact.
#notification_category_subscriptionsrJ   ,)r=   r>   name
updateMaskr@   rA   rB   )appendjoinr6   r7   rC   r/   ,EssentialcontactsFoldersContactsPatchRequestr3   Patch2EssentialcontactsOrganizationsContactsPatchRequestr5   -EssentialcontactsProjectsContactsPatchRequestr1   )	r8   contact_namerI   rJ   update_masksupdate_maskrK   rL   
update_reqs	            r   UpdateContactsClient.Updatex   s0    L?@.)((<(K""*A  # "G 	kD y))>>NN j""((44//>>TT j((..z::MM 
J!!''
33r   c                    UR                  S5      (       a4  U R                  R                  US9nU R                  R	                  U5      $ UR                  S5      (       a4  U R                  R                  US9nU R                  R	                  U5      $ U R                  R                  US9nU R                  R	                  U5      $ )zDeletes an Essential Contact.

Args:
  contact_name: the full id of the contact to delete in the form of
    [projects|folders|organizations]/{resourceId}/contacts/{contactId}

Returns:
  Empty response message.
r@   rR   rA   )	rC   r/   -EssentialcontactsFoldersContactsDeleteRequestr3   Delete3EssentialcontactsOrganizationsContactsDeleteRequestr5   .EssentialcontactsProjectsContactsDeleteRequestr1   )r8   rZ   
delete_reqs      r   rc   ContactsClient.Delete   s     y))>>OO P j""))*55//>>UU V j((//
;;NN O J!!((44r   c                    UR                  S5      (       a4  U R                  R                  US9nU R                  R	                  U5      $ UR                  S5      (       a4  U R                  R                  US9nU R                  R	                  U5      $ U R                  R                  US9nU R                  R	                  U5      $ )zDescribes an Essential Contact.

Args:
  contact_name: the full id of the contact to describe in the form of
    [projects|folders|organizations]/{resourceId}/contacts/{contactId}

Returns:
  The requested contact.
r@   ra   rA   )	rC   r/   *EssentialcontactsFoldersContactsGetRequestr3   Get0EssentialcontactsOrganizationsContactsGetRequestr5   +EssentialcontactsProjectsContactsGetRequestr1   )r8   rZ   describe_reqs      r   DescribeContactsClient.Describe   s     y))^^NN O l""&&|44//^^TT U l((,,\::>>MM N L!!%%l33r   Nc           	      v   SnSnUR                  S5      (       a&  U R                  nU R                  R                  US9nOaUR                  S5      (       a&  U R                  nU R                  R                  US9nO%U R                  nU R                  R                  US9n[        R                  " UUUUSSS9$ )a  Lists Essential Contacts set directly on a Cloud resource.

Args:
  parent_name: the full name of the parent resource to list contacts for in
    the form of [projects|folders|organizations]/{resourceId}
  page_size: the number of contacts to return per page of the result list.
  limit: the total number of contacts to return.

Returns:
  The contacts that have been set directly on the requested resource.
Nr@   )r?   rA   contactspageSize)
batch_sizelimitfieldbatch_size_attribute)
rC   r3   r/   +EssentialcontactsFoldersContactsListRequestr5   1EssentialcontactsOrganizationsContactsListRequestr1   ,EssentialcontactsProjectsContactsListRequestr   YieldFromList)r8   rH   	page_sizert   servicelist_reqs         r   ListContactsClient.List   s     GHi((%%gKK L h				0	0++gQQ R h &&gLL M h ##') )r   c           
      x   SnSnUR                  S5      (       a&  U R                  nU R                  R                  XS9nOaUR                  S5      (       a&  U R                  nU R                  R                  XS9nO%U R                  nU R                  R                  XS9n[        R                  " UUUUSSSS9$ )	a  Computes the Essential Contacts for a Cloud resource.

Args:
  parent_name: the full name of the parent resource to compute contacts for
    in the form of [projects|folders|organizations]/{resourceId}
  notification_categories: the notification categories (as choices) to
    retrieve subscribed contacts for.
  page_size: the number of contacts to return per page of the result list.
  limit: the total number of contacts to return.

Returns:
  The contacts that have been computed from the resource hierarchy.
Nr@   )r?   notificationCategoriesrA   Computerq   rr   )rs   rt   methodru   rv   )
rC   r3   r/   .EssentialcontactsFoldersContactsComputeRequestr5   4EssentialcontactsOrganizationsContactsComputeRequestr1   /EssentialcontactsProjectsContactsComputeRequestr   rz   )r8   rH   rI   r{   rt   r|   compute_reqs          r   r   ContactsClient.Compute   s    $ GKi((%%gNNQQ R Nk				0	0++gNNWW X Nk &&gNNRR S Nk ##') )r   )r3   r/   r5   r1   r-   r6   r7   )2   N)__name__
__module____qualname____firstlineno____doc__DEFAULT_API_VERSIONr9   rE   r^   rc   rn   r~   r   __static_attributes__rB   r   r   r*   r*   C   s6    *0 ;  5D)4V5040")N 	))r   r*   N)r   apitools.base.pyr   googlecloudsdk.api_lib.utilr   r   ALPHA_API_VERSIONBETA_API_VERSIONGA_API_VERSIONr   r   r   r   r"   r$   r(   r*   rB   r   r   <module>r      s     ( ,  $  CE BD =?   2 =
 , H 2 ? !4 : 0C I
]) ])r   