
                         &   S r SSKJr  SSKJr  SSKJr  SSKJr  \R                  " \R                  R                  \R                  R                  \R                  R                  5      \R                   " S S\R                  5      5       5       rg)	z5Command to compute Essential Contacts for a resource.    )contacts)base)flags)utilc                   >    \ rS rSrSr\S 5       r\S 5       rS rSr	g)Compute   a  Compute the essential contacts that are subscribed to the specified notification categories for a resource.

This command will return the contacts subscribed to any of the notification
categories that have been set on the requested resource or any of its
ancestors.

## EXAMPLES

To compute contacts subscribed to the technical category for the current
project, run:

      $ {command} --notification-categories=technical

To compute contacts subscribed to the product-updates or billing categories
for the folder with id ``123'', run:

      $ {command} --notification-categories=product-updates,billing
      --folder=123

To compute contacts subscribed to the legal category for the organization with
id ``456'', run:

      $ {command} --notification-categories=legal --organization=456
c                 P   U R                  S5      (       a)  [        R                  " 5       R                  R                  $ U R                  S5      (       a)  [        R                  " 5       R
                  R                  $ [        R                  " 5       R                  R                  $ )z`Gets the NotificationCategory enum to cast the args as based on the type of parent resource arg.foldersorganizations)
startswithr   GetMessages.EssentialcontactsFoldersContactsComputeRequest%NotificationCategoriesValueValuesEnum4EssentialcontactsOrganizationsContactsComputeRequest/EssentialcontactsProjectsContactsComputeRequest)parent_names    )lib/surface/essential_contacts/compute.py(_GetNotificationCategoryEnumByParentType0Compute._GetNotificationCategoryEnumByParentType5   s     i((!! 667\7\] o..!! <<=b=bc  556[6[\    c                     [         R                  " U [        R                  " 5       SS9  [         R                  " U 5        [
        R                  R                  U 5        g)zAdds command-specific args.T)requiredN)r   AddNotificationCategoriesArgr   "GetContactNotificationCategoryEnumAddParentArgsr   URI_FLAGRemoveFromParser)parsers    r   ArgsCompute.ArgsC   sC     
&&;;=N	MM""6*r   c                     [         R                  " U5      nU R                  U5      n[         R                  " UU5      n[        R
                  " 5       nUR                  X$UR                  UR                  S9$ )z"Runs the compute contacts command.)limit	page_size)	r   	GetParentr   GetNotificationCategoriesr   ContactsClientr   r#   r$   )selfargsr   notification_category_enum
categoriesclients         r   RunCompute.RunK   sq    ..&K!%!N!N"//0JLJ $$&F>>tzzT^^  M Mr    N)
__name__
__module____qualname____firstlineno____doc__staticmethodr   r    r-   __static_attributes__r/   r   r   r   r      s7    2 \ \ + +
Mr   r   N)r4   )googlecloudsdk.api_lib.essential_contactsr   googlecloudsdk.callioper   -googlecloudsdk.command_lib.essential_contactsr   r   ReleaseTracksReleaseTrackALPHABETAGAUniverseCompatibleListCommandr   r/   r   r   <module>rA      s    < ? ( ? > D%%++T->->-C-C%%((*:Md :M *:Mr   