
    9                     N    S r SSKJr  SrSrSrSrS\S\S	\4S
 jr	 " S S5      r
g)z+Client for interacting with Management Hub.    )apiszedition_config,filterfoldersorganizationsprojectsresource_typeresource_idreturnc                     U  SU S3$ )z$Returns the full id of the resource./z/locations/global/managementHub r   r   s     8lib/googlecloudsdk/api_lib/storage/management_hub_api.py_get_full_id_stringr      s    ?!K=(G	HH    c                      ^  \ rS rSrSrU 4S jr   SS jrS r       SS jr          SS jr	S r
S	 rS
 rS rS rS r       SS jr       SS jr       SS jrSrU =r$ )ManagementHubApi   zClient for Management Hub API.c                    > [         [        U ]  5         [        R                  " SS5      U l        [        R                  " SS5      U l        g )Nstoragev2)superr   __init__	core_apisGetClientInstanceclientGetMessagesModulemessages)self	__class__s    r   r   ManagementHubApi.__init__"   s9    	
D*,--i>DK//	4@DMr   c                     U R                   R                  5       nU R                   R                  R                  R                  Ul        Xl        U" U[        US9nU" U5      $ )z3Disables the management hub for the given resource.managementHub
updateMaskname)r   ManagementHubEditionConfigValueValuesEnumDISABLEDeditionConfigr%   _FULL_UPDATE_MASK)r   full_idrequest_message_classpatch_methodmanagement_hubrequests         r   _disable_management_hub(ManagementHubApi._disable_management_hub'   s_     ]]002N##@@II   "#$$G   r   c           	      <   / nUb9  UR                  U Vs/ s H  nU R                  R                  US9PM     sn5        Ub9  UR                  U Vs/ s H  nU R                  R                  US9PM     sn5        U R                  R                  US9$ s  snf s  snf )a  Returns the cloud storage buckets filter for the given args.

Args:
  bucket_ids: List of bucket ids to be included in the filter.
  bucket_id_regexes: List of bucket id regexes to be included in the filter.

Returns:
  The cloud storage buckets filter message.
)bucketId)bucketIdRegex)cloudStorageBuckets)extendr   CloudStorageBucket&ManagementHubFilterCloudStorageBuckets)r   
bucket_idsbucket_id_regexesbuckets_filter	bucket_idbucket_id_regexs         r   !_get_cloud_storage_buckets_filter2ManagementHubApi._get_cloud_storage_buckets_filter<   s     N%%i --
*
*I
*
>% 	
 $!2!2o --
*
*
*
I!2 	
 ==??* @  s   #B#Bc	                    U R                   R                  5       Ul        Sn	U(       a4  U R                   R                  R                  R
                  Ul        U	S-   $ U R                   R                  R                  R                  Ul        Ub-  U R                   R                  US9UR                  l	        U	S-  n	Ub-  U R                   R                  US9UR                  l
        U	S-  n	Uc  Ub%  U R                  XW5      UR                  l        U	S-  n	Uc  Ub%  U R                  Xh5      UR                  l        U	S-  n	U	$ )a  Updates the management hub filter and returns update_mask.

Args:
  management_hub: The management hub object to be updated.
  inherit_from_parent: Whether to inherit config from the parent.
  include_locations: List of locations to be included in the filter.
  exclude_locations: List of locations to be excluded in the filter.
  include_bucket_ids: List of bucket ids to be included in the filter.
  exclude_bucket_ids: List of bucket ids to be excluded in the filter.
  include_bucket_id_regexes: List of bucket id regexes to be included in the
    filter.
  exclude_bucket_id_regexes: List of bucket id regexes to be excluded in the
    filter.

Returns:
  The update mask to be used for the request.
edition_configz,filter)	locationsz(,filter.included_cloud_storage_locationsz(,filter.excluded_cloud_storage_locationsz&,filter.included_cloud_storage_bucketsz&,filter.excluded_cloud_storage_buckets)r   ManagementHubFilterfilterr&   r'   INHERITr)   STANDARD(ManagementHubFilterCloudStorageLocationsincludedCloudStorageLocationsexcludedCloudStorageLocationsr>   includedCloudStorageBucketsexcludedCloudStorageBuckets)
r   r.   inherit_from_parentinclude_locationsexclude_locationsinclude_bucket_idsexclude_bucket_idsinclude_bucket_id_regexesexclude_bucket_id_regexesupdate_masks
             r   _set_management_hub_filter+ManagementHubApi._set_management_hub_filterX   sf   : !MM==?N"K 
--
%
%
B
B
J
J " "" 	##@@II  
 $
--
@
@) A  9
 ??k$
--
@
@) A  9
 ??k %)B)N

0
0  7
 ==k%)B)N

0
0  7
 ==kr   c           
          U R                   R                  5       nXl        U R                  UUUUUUUU5      nU
" U	" XUS95      $ )z2Updates the management hub for the given resource.r"   )r   r&   r%   rT   )r   r+   rL   rM   rN   rO   rP   rQ   rR   r,   r-   r.   rS   s                r   _update_management_hub'ManagementHubApi._update_management_hub   s`     ]]002N!11!!	K (w	
 r   c                     [        [        US9nU R                  R                  US9nU R                  R
                  R                  U5      $ )zGets the management hub for the given sub folder.

Args:
  folder_id: Id of the GCP hierarchy folder.

Returns:
  The management hub object for the given sub folder.
r   r%   )r   _FOLDER_RESOURCE_TYPEr   .StorageFoldersLocationsGetManagementHubRequestr   folders_locationsGetManagementHub)r   	folder_id	full_namer/   s       r   get_sub_folder_management_hub.ManagementHubApi.get_sub_folder_management_hub   sO     $+I mmJJ K G ;;((99'BBr   c                     [        [        US9nU R                  R                  US9nU R                  R
                  R                  U5      $ )zGets the management hub for the given project.

Args:
  project_name: Name of the GCP project.

Returns:
  The management hub object for the given project.
r   rZ   )r   _PROJECT_RESOURCE_TYPEr   /StorageProjectsLocationsGetManagementHubRequestr   projects_locationsr^   )r   project_namer`   r/   s       r   get_project_management_hub+ManagementHubApi.get_project_management_hub   sO     $,,I mmKK L G ;;))::7CCr   c                     [        [        US9nU R                  R                  US9nU R                  R
                  R                  U5      $ )zGets the management hub for the given organization.

Args:
  organization_id: Id of the GCP organization.

Returns:
  The management hub object for the given organization.
r   rZ   )r   _ORGANIZATION_RESOURCE_TYPEr   4StorageOrganizationsLocationsGetManagementHubRequestr   organizations_locationsr^   )r   organization_idr`   r/   s       r   get_organization_management_hub0ManagementHubApi.get_organization_management_hub   sR     $1I
 	JJ 	K 	
 
 ;;..??HHr   c                     [        [        US9nU R                  UU R                  R                  U R
                  R                  R                  S9$ )zDisables the management hub for the given project.

Args:
  project_name: Name of the GCP project.

Returns:
  The management hub object for the given project.
r   r+   r,   r-   )r   rd   r0   r   2StorageProjectsLocationsUpdateManagementHubRequestr   rf   UpdateManagementHub)r   rg   r`   s      r   disable_project_management_hub/ManagementHubApi.disable_project_management_hub   sP     $,,I ''"mm^^[[33GG (  r   c                     [        [        US9nU R                  UU R                  R                  U R
                  R                  R                  S9$ )zDisables the management hub for the given organization.

Args:
  organization_id: Id of the GCP organization.

Returns:
  The management hub object for the given organization.
r   rr   )r   rk   r0   r   7StorageOrganizationsLocationsUpdateManagementHubRequestr   rm   rt   )r   rn   r`   s      r   #disable_organization_management_hub4ManagementHubApi.disable_organization_management_hub  sP     $1I ''"mmcc[[88LL (  r   c                     [        [        US9nU R                  UU R                  R                  U R
                  R                  R                  S9$ )zDisables the management hub for the given sub folder.

Args:
  sub_folder_id: Id of the GCP hierarchy folder.

Returns:
  The management hub object for the given sub folder.
r   rr   )r   r[   r0   r   1StorageFoldersLocationsUpdateManagementHubRequestr   r]   rt   )r   sub_folder_idr`   s      r   !disable_sub_folder_management_hub2ManagementHubApi.disable_sub_folder_management_hub%  sP     $+I ''"mm]][[22FF (  r   c	                     [        SUS9n	U R                  U	UUUUUUUU R                  R                  U R                  R
                  R                  5
      $ )a  Updates the management hub for the given GCP project.

Args:

  project: Name of the GCP project.
  inherit_from_parent: Whether to inherit config from the parent.
  include_locations: List of locations to be included in the filter.
  exclude_locations: List of locations to be excluded in the filter.
  include_bucket_ids: List of bucket ids to be included in the filter.
  exclude_bucket_ids: List of bucket ids to be excluded in the filter.
  include_bucket_id_regexes: List of bucket id regexes to be included in the
    filter.
  exclude_bucket_id_regexes: List of bucket id regexes to be excluded in the
    filter.

Returns:
  The management hub object.
r   r   )r   rW   r   rs   r   rf   rt   )
r   projectrL   rM   rN   rO   rP   rQ   rR   r`   s
             r   update_project_management_hub.ManagementHubApi.update_project_management_hub8  s`    < $ gI &&!!HH&&:: r   c	                     [        SUS9n	U R                  U	UUUUUUUU R                  R                  U R                  R
                  R                  5
      $ )a  Updates the management hub for the given GCP sub folder.

Args:

  sub_folder: The GCP sub folder name.
  inherit_from_parent: Whether to inherit config from the parent.
  include_locations: List of locations to be included in the filter.
  exclude_locations: List of locations to be excluded in the filter.
  include_bucket_ids: List of bucket ids to be included in the filter.
  exclude_bucket_ids: List of bucket ids to be excluded in the filter.
  include_bucket_id_regexes: List of bucket id regexes to be included in the
    filter.
  exclude_bucket_id_regexes: List of bucket id regexes to be excluded in the
    filter.

Returns:
  The management hub object.
r   r   )r   rW   r   r|   r   r]   rt   )
r   
sub_folderrL   rM   rN   rO   rP   rQ   rR   r`   s
             r    update_sub_folder_management_hub1ManagementHubApi.update_sub_folder_management_hubg  s`    : $ZI &&!!GG%%99 r   c	                     [        SUS9n	U R                  U	UUUUUUUU R                  R                  U R                  R
                  R                  5
      $ )a  Updates the management hub for the given GCP organization.

Args:

  organization: The GCP organization name.
  inherit_from_parent: Whether to inherit config from the parent.
  include_locations: List of locations to be included in the filter.
  exclude_locations: List of locations to be excluded in the filter.
  include_bucket_ids: List of bucket ids to be included in the filter.
  exclude_bucket_ids: List of bucket ids to be excluded in the filter.
  include_bucket_id_regexes: List of bucket id regexes to be included in the
    filter.
  exclude_bucket_id_regexes: List of bucket id regexes to be excluded in the
    filter.

Returns:
  The management hub object.
r   r   )r   rW   r   rx   r   rm   rt   )
r   organizationrL   rM   rN   rO   rP   rQ   rR   r`   s
             r   "update_organization_management_hub3ManagementHubApi.update_organization_management_hub  s`    : $%<I &&!!MM++?? r   )r   r   )NNN)FNNNNNN)
NNNNNNNNNN)NNNNNNN)__name__
__module____qualname____firstlineno____doc__r   r0   r>   rT   rW   ra   rh   ro   ru   ry   r~   r   r   r   __static_attributes____classcell__)r   s   @r   r   r      s    &A  	!*>   $ $K^  $ $  DC$D$I(&&,  $ $-d  $ $,b  $ $, ,r   r   N)r   googlecloudsdk.api_lib.utilr   r   r*   r[   rk   rd   strr   r   r   r   r   <module>r      sQ    2 9 , ! - # Is I I I
b br   