
    5                         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
\5      r " S S\5      r " S S\5      r " S S\5      rg)zNCommands for interacting with the Cloud NetApp Files Host Groups API resource.    )
list_pager)	constants)util)waiter)base)log)	resourcesc                       \ rS rSrSr\R                  R                  4S jr\	S 5       r
\	S 5       rS rS r      SS	 jrS
 rS rS r   SS jrS rSrg)HostGroupsClient   zJWrapper for working with Host Groups in the Cloud NetApp Files API Client.c                    Xl         U R                   [        R                  R                  :X  a  [	        5       U l        g U R                   [        R                  R                  :X  a  [        5       U l        g U R                   [        R                  R                  :X  a  [        5       U l        g [        SR                  [        R                  U   5      5      e)Nz [{}] is not a valid API version.)release_trackr   ReleaseTrackALPHAAlphaHostGroupsAdapter_adapterBETABetaHostGroupsAdapterGAHostGroupsAdapter
ValueErrorformatnetapp_api_utilVERSION_MAP)selfr   s     7lib/googlecloudsdk/api_lib/netapp/host_groups/client.py__init__HostGroupsClient.__init__   s    &T..444,.dm			t0055	5+-dm			t0033	3')dm
,
3
3))-8     c                 .    U R                   R                  $ N)r   clientr   s    r   r"   HostGroupsClient.client-   s    ==r   c                 .    U R                   R                  $ r!   )r   messagesr#   s    r   r&   HostGroupsClient.messages1   s    ==!!!r   c                     [         R                  " [         R                  " U R                  R                  5      USR                  UR                  5       5      5      $ )zWaits on the long-running operation until the done field is True.

Args:
  operation_ref: the operation reference.

Raises:
  waiter.OperationError: if the operation contains an error.

Returns:
  the 'response' field of the Operation.
zWaiting for [{0}] to finish)r   WaitForCloudOperationPollerNoResourcesr"   projects_locations_operationsr   Name)r   operation_refs     r   WaitForOperation!HostGroupsClient.WaitForOperation5   sL     >>..KK55	
 	%,,]-?-?-AB r   c                 v   U R                   R                  UR                  5       R                  5       UR	                  5       US9nU R
                  R                  R                  U5      nU(       a  U$ [        R                  R                  UR                  [        R                  S9nU R                  U5      $ )z!Create a Cloud NetApp Host Group.)parenthostGroupId	hostGroup
collection)r&   .NetappProjectsLocationsHostGroupsCreateRequestParentRelativeNamer,   r"   projects_locations_hostGroupsCreater	   REGISTRYParseRelativeNamenamer   OPERATIONS_COLLECTIONr.   )r   host_group_refasync_configrequest	create_opr-   s          r   CreateHostGroup HostGroupsClient.CreateHostGroupI   s    mmJJ$$&335"'') K G
 99@@II&&889#B#B 9 M   //r   Nc                     U R                   R                  5       nXl        X'l        X7l        XGl        XWl        Xgl        U$ )zFParses the command line arguments for Create Host Group into a config.)r&   	HostGroupr=   typehostsosTypedescriptionlabels)r   r=   host_group_typerI   os_typerK   rL   
host_groups           r   ParseHostGroupConfig%HostGroupsClient.ParseHostGroupConfigX   s>     ((*JO%O(r   c                 `   U R                   R                  US9nU R                  R                  R	                  U5      nUR
                   H(  n[        R                  " SR                  U5      5        M*     [        R                  " U R                  R                  U[        R                  SS9$ )zList Cloud NetApp Host Groups.

Args:
  location_ref: The parent location to list Cloud Netapp Host Groups.

Returns:
  Generator that yields the Cloud Netapp Host Groups.
)r1   zLocation {} may be unreachable.pageSize)fieldbatch_size_attribute)r&   ,NetappProjectsLocationsHostGroupsListRequestr"   r9   Listunreachabler   warningr   r   YieldFromListr   HOST_GROUP_RESOURCE)r   location_refrB   responselocations        r   ListHostGroupsHostGroupsClient.ListHostGroupsk   s     mmHH I G {{88==gFH((	kk3::8DE )##11++'	 r   c                     U R                   R                  UR                  5       S9nU R                  R                  R                  U5      $ )zGet a Cloud NetApp Host Group.r=   )r&   +NetappProjectsLocationsHostGroupsGetRequestr8   r"   r9   Get)r   r?   rB   s      r   GetHostGroupHostGroupsClient.GetHostGroup   sE    mmGG((* H G ;;4488AAr   c                 :   U R                   R                  UR                  5       S9nU R                  R                  R                  U5      nU(       a  U$ [        R                  R                  UR                  [        R                  S9nU R                  U5      $ )z!Delete a Cloud NetApp Host Group.rb   r4   )r&   .NetappProjectsLocationsHostGroupsDeleteRequestr8   r"   r9   Deleter	   r;   r<   r=   r   r>   r.   )r   r?   r@   rB   	delete_opr-   s         r   DeleteHostGroup HostGroupsClient.DeleteHostGroup   s    mmJJ((* K G 99@@II&&889#B#B 9 M   //r   c                 <    Ub  X!l         Ub  X1l        Ub  XAl        U$ )a'  Parses updates into a host group config.

Args:
  host_group_config: The host group config to update.
  hosts: list of str, new list of hosts, if any.
  description: str, a new description, if any.
  labels: LabelsValue message, the new labels value, if any.

Returns:
  The host group message.
)rI   rK   rL   )r   host_group_configrI   rK   rL   s        r   ParseUpdatedHostGroupConfig,HostGroupsClient.ParseUpdatedHostGroupConfig   s.    $  %&1#!'r   c                 >   U R                   R                  UR                  5       UUS9nU R                  R                  R                  U5      nU(       a  U$ [        R                  R                  UR                  [        R                  S9nU R                  U5      $ )aA  Updates a Cloud NetApp Host Group.

Args:
  host_group_ref: the reference to the Host Group.
  host_group: Host group config, the updated host group.
  update_mask: str, a comma-separated list of updated fields.
  async_: bool, if False, wait for the operation to complete.

Returns:
  an Operation or HostGroup message.
)r=   
updateMaskr3   r4   )r&   -NetappProjectsLocationsHostGroupsPatchRequestr8   r"   r9   Patchr	   r;   r<   r=   r   r>   r.   )r   r?   rO   update_maskr@   rB   	update_opr-   s           r   UpdateHostGroup HostGroupsClient.UpdateHostGroup   s     mmII((* J G
 99??HI&&889#B#B 9 M   //r   )r   r   )NNNNNN)NNN)__name__
__module____qualname____firstlineno____doc__r   r   r   r   propertyr"   r&   r.   rD   rP   r_   re   rk   ro   rw   __static_attributes__ r   r   r   r      s    R#'#4#4#:#:      " "(0" &.B0  40r   r   c                       \ rS rSrSrS rSrg)r      ;Adapter for the Cloud NetApp Files API Host Group resource.c                     [         R                  R                  U l        [        R
                  " U R                  S9U l        [        R                  " U R                  S9U l        g N)r   )	r   r   r   r   r   GetClientInstancer"   GetMessagesModuler&   r#   s    r   r   HostGroupsAdapter.__init__   sN    **--D!33((DK $55((DMr   r"   r&   r   N)ry   rz   r{   r|   r}   r   r   r   r   r   r   r      s
    Cr   r   c                   ,   ^  \ rS rSrSrU 4S jrSrU =r$ )r      z@Adapter for the Beta Cloud NetApp Files API Host Group resource.c                    > [         [        U ]  5         [        R                  R
                  U l        [        R                  " U R                  S9U l	        [        R                  " U R                  S9U l        g r   )superr   r   r   r   r   r   r   r   r"   r   r&   r   	__class__s    r   r   BetaHostGroupsAdapter.__init__   s]    	
/1**//D!33((DK $55((DMr   r   ry   rz   r{   r|   r}   r   r   __classcell__r   s   @r   r   r      s    H r   r   c                   ,   ^  \ rS rSrSrU 4S jrSrU =r$ )r      r   c                    > [         [        U ]  5         [        R                  R
                  U l        [        R                  " U R                  S9U l	        [        R                  " U R                  S9U l        g r   )r   r   r   r   r   r   r   r   r   r"   r   r&   r   s    r   r   AlphaHostGroupsAdapter.__init__   s]    	
 $02**00D!33((DK $55((DMr   r   r   r   s   @r   r   r      s    C r   r   N)r}   apitools.base.pyr   googlecloudsdk.api_lib.netappr   r   r   googlecloudsdk.api_lib.utilr   googlecloudsdk.callioper   googlecloudsdk.corer   r	   objectr   r   r   r   r   r   r   <module>r      sU     U ' 3 A . ( # )l0v l0^
 
- 2 r   