
    p                         d Z ddlmZ ddlmZ ddlmZ ddlZddlmZ ddlm	Z	 ddlm
Z
 dd	lmZ d
 Zd Zd Zd Zd Zd Zd Zd Zy)z,Utilities for Data Catalog entries commands.    )absolute_import)division)unicode_literalsN)
list_pager)GetClientInstance)GetMessagesModule)logc                 v    t         j                  j                  dj                  |j                               | S )Nz+Items were removed from address group [{}].r	   statusPrintformataddress_groupresponseargss     7lib/googlecloudsdk/command_lib/network_security/util.pyLogRemoveItemsSuccessr      s/    **3::4;M;MN 
/    c                 v    t         j                  j                  dj                  |j                               | S )Nz'Items were added to address group [{}].r   r   s     r   LogAddItemsSuccessr   #   s/    **/66t7I7IJ 
/r   c                       y)zSet default location to global.global r   r   r   SetGlobalLocationr   *   s    	r   c                     |j                   }t        j                  j                  |      |k(  r?t        j                  j	                  |j
                        }|d||j                  _        |S )N/)sourceospathbasenamedirnameaddressGroupcloneAddressGroupItemsRequestsourceAddressGroup)_argrequestsource_namelocations        r   FormatSourceAddressGroupr+   /   sX    

+WWk"k1www334H@G))< 
.r   c                     t         j                  j                  dj                  |j                  |j
                               | S )Nz2Items were cloned to address group [{}] from [{}].)r	   r   r   r   r   r   r   s     r   LogCloneItemsSuccessr-   :   s8    **:AA


dkk
 
/r   c                 t    t        |       j                  }t        |       }|j                  }t	        |||      S N)r    projects_locations_addressGroupsr   BNetworksecurityProjectsLocationsAddressGroupsListReferencesRequestListAddressGroupReferencesrelease_trackr   servicemessagesrequest_types        r   !ListProjectAddressGroupReferencesr8   C   s;    m,MM'}-(QQ  
$G\4	@@r   c                 t    t        |       j                  }t        |       }|j                  }t	        |||      S r/   )r   %organizations_locations_addressGroupsr   GNetworksecurityOrganizationsLocationsAddressGroupsListReferencesRequestr2   r3   s        r   &ListOrganizationAddressGroupReferencesr<   L   sC    )) 
 }-(VV  
$G\4	@@r   c                     |j                   j                  j                         } ||j                               }t	        j
                  | ||j                  |j                  ddddd	      S )N)r#   ListReferencesaddressGroupReferences	pageTokennextPageTokenpageSize)limit
batch_sizemethodfieldcurrent_token_attributenext_token_attributebatch_size_attribute)CONCEPTSr   ParseRelativeNamer   YieldFromListrC   	page_size)r5   r7   r   r   r(   s        r   r2   r2   W   sc    ----335-m&@&@&BC'		!	!JJ$)*%

 
r   )__doc__
__future__r   r   r   r   apitools.base.pyr   'googlecloudsdk.api_lib.network_securityr   r   googlecloudsdk.corer	   r   r   r   r+   r-   r8   r<   r2   r   r   r   <module>rT      sL    3 &  ' 	 ' E E #
AAr   