
    4                     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)z5Client for interacting with Storage Intelligence API.    )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/intelligenceConfig r   r   s     >lib/googlecloudsdk/api_lib/storage/storage_intelligence_api.py_get_full_id_stringr      s    ?!K=(L	MM    c                      ^  \ rS rSrSrU 4S jr   SS j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$ )StorageIntelligenceApi   z$Client for Storage Intelligence 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   StorageIntelligenceApi.__init__"   s9    	
 $02--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      $ )z-Disables Intelligence for the given resource.intelligenceConfig
updateMaskname)r   IntelligenceConfigEditionConfigValueValuesEnumDISABLEDeditionConfigr%   _FULL_UPDATE_MASK)r   full_idrequest_message_classpatch_methodintelligence_configrequests         r   _disable_intelligence,StorageIntelligenceApi._disable_intelligence'   s`     --::<((EENN %  '#.$G   r   c                    U R                   R                  5       Ul        SnU(       a4  U R                   R                  R                  R
                  Ul        US-   $ U(       a*  U R                   R                  R                  R                  O)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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$ )	a  Updates the Intelligence filter and returns update_mask.

Args:
  intelligence_config: The Intelligence Config object to be updated.
  inherit_from_parent: Whether to inherit config from the parent.
  trial_edition: Whether to enable Storage Intelligence for TRIAL edition.
  include_locations: List of locations to be included in the filter.
  exclude_locations: List of locations 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_locations)bucketIdRegexesz&,filter.included_cloud_storage_bucketsz&,filter.excluded_cloud_storage_buckets)r   Filterfilterr&   r'   INHERITr)   TRIALSTANDARDCloudStorageLocationsincludedCloudStorageLocationsexcludedCloudStorageLocationsCloudStorageBucketsincludedCloudStorageBucketsexcludedCloudStorageBuckets)	r   r.   inherit_from_parenttrial_editioninclude_locationsexclude_locationsinclude_bucket_id_regexesexclude_bucket_id_regexesupdate_masks	            r   _set_intelligence_filter/StorageIntelligenceApi._set_intelligence_filter<   s   6 "&!5!5!7"K 
--
*
*
G
G
O
O ' ""  	((EEKK]]--JJSS % $
--
-
-8I
-
J   > ??k$
--
-
-8I
-
J   > ??k !,
--
+
+7 ,    <
 ==k ,
--
+
+7 ,    <
 ==kr   c
           	          U R                   R                  5       n
Xl        U R                  U
UUUUUU5      nU	" U" U
UUS95      $ )z7Updates the Intelligence Config for the given resource.r"   )r   r&   r%   rH   )r   r+   rA   rB   rC   rD   rE   rF   r,   r-   r.   rG   s               r   _update_intelligence_config2StorageIntelligenceApi._update_intelligence_config   sb     --::<&//!!K 2"	
 r   c                     [        [        US9nU R                  R                  US9nU R                  R
                  R                  U5      $ )zGets the Intelligence Config for the given sub folder.

Args:
  folder_id: Id of the GCP hierarchy folder.

Returns:
  The Intelligence Config object.
r   r%   )r   _FOLDER_RESOURCE_TYPEr   3StorageFoldersLocationsGetIntelligenceConfigRequestr   folders_locationsGetIntelligenceConfig)r   	folder_id	full_namer/   s       r   "get_sub_folder_intelligence_config9StorageIntelligenceApi.get_sub_folder_intelligence_config   sO     $+I mmOO P G ;;((>>wGGr   c                     [        [        US9nU R                  R                  US9nU R                  R
                  R                  U5      $ )zGets the Intelligence Config for the given project.

Args:
  project_name: Name of the GCP project.

Returns:
  The Intelligence Config object.
r   rN   )r   _PROJECT_RESOURCE_TYPEr   4StorageProjectsLocationsGetIntelligenceConfigRequestr   projects_locationsrR   )r   project_namerT   r/   s       r   get_project_intelligence_config6StorageIntelligenceApi.get_project_intelligence_config   sR     $,,I
 	JJ 	K 	
 
 ;;))??HHr   c                     [        [        US9nU R                  R                  US9nU R                  R
                  R                  U5      $ )zGets the Intelligence Config for the given organization.

Args:
  organization_id: Id of the GCP organization.

Returns:
  The Intelligence Config object.
r   rN   )r   _ORGANIZATION_RESOURCE_TYPEr   9StorageOrganizationsLocationsGetIntelligenceConfigRequestr   organizations_locationsrR   )r   organization_idrT   r/   s       r   $get_organization_intelligence_config;StorageIntelligenceApi.get_organization_intelligence_config   sR     $1I
 	OO 	P 	
 
 ;;..DDWMMr   c                     [        [        US9nU R                  UU R                  R                  U R
                  R                  R                  S9$ )zDisables the Storage Intelligence for the given project.

Args:
  project_name: Name of the GCP project.

Returns:
  The Intelligence Config object.
r   r+   r,   r-   )r   rX   r0   r   7StorageProjectsLocationsUpdateIntelligenceConfigRequestr   rZ   UpdateIntelligenceConfig)r   r[   rT   s      r   #disable_project_intelligence_config:StorageIntelligenceApi.disable_project_intelligence_config   sP     $,,I %%"mmcc[[33LL &  r   c                     [        [        US9nU R                  UU R                  R                  U R
                  R                  R                  S9$ )zDisables the Storage Intelligence for the given organization.

Args:
  organization_id: Id of the GCP organization.

Returns:
  The Intelligence Config object.
r   rf   )r   r_   r0   r   <StorageOrganizationsLocationsUpdateIntelligenceConfigRequestr   ra   rh   )r   rb   rT   s      r   (disable_organization_intelligence_config?StorageIntelligenceApi.disable_organization_intelligence_config   sP     $1I %%"mmhh[[88QQ &  r   c                     [        [        US9nU R                  UU R                  R                  U R
                  R                  R                  S9$ )zDisables the Storage Intelligence for the given sub folder.

Args:
  sub_folder_id: Id of the GCP hierarchy folder.

Returns:
  The Intelligence Config object.
r   rf   )r   rO   r0   r   6StorageFoldersLocationsUpdateIntelligenceConfigRequestr   rQ   rh   )r   sub_folder_idrT   s      r   &disable_sub_folder_intelligence_config=StorageIntelligenceApi.disable_sub_folder_intelligence_config  sP     $+I %%"mmbb[[22KK &  r   c                     [        SUS9nU R                  UUUUUUUU R                  R                  U R                  R
                  R                  5	      $ )a[  Updates the Intelligence Config for the given GCP project.

Args:
  project: Name of the GCP project.
  inherit_from_parent: Whether to inherit config from the parent.
  trial_edition: Whether to enable Storage Intelligence for TRIAL edition.
  include_locations: List of locations to be included in the filter.
  exclude_locations: List of locations 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 Intelligence Config object.
r   r   )r   rK   r   rg   r   rZ   rh   )	r   projectrA   rB   rC   rD   rE   rF   rT   s	            r   "update_project_intelligence_config9StorageIntelligenceApi.update_project_intelligence_config  s]    6 $ gI ++!!MM&&??
 
r   c                     [        SUS9nU R                  UUUUUUUU R                  R                  U R                  R
                  R                  5	      $ )aa  Updates the Intelligence Config for the given GCP sub folder.

Args:
  sub_folder: The GCP sub folder name.
  inherit_from_parent: Whether to inherit config from the parent.
  trial_edition: Whether to enable Storage Intelligence for TRIAL edition.
  include_locations: List of locations to be included in the filter.
  exclude_locations: List of locations 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 Intelligence Config object.
r   r   )r   rK   r   rp   r   rQ   rh   )	r   
sub_folderrA   rB   rC   rD   rE   rF   rT   s	            r   %update_sub_folder_intelligence_config<StorageIntelligenceApi.update_sub_folder_intelligence_configE  s]    4 $ZI ++!!LL%%>>
 
r   c                     [        SUS9nU R                  UUUUUUUU R                  R                  U R                  R
                  R                  5	      $ )ag  Updates the Intelligence Config for the given GCP organization.

Args:
  organization: The GCP organization name.
  inherit_from_parent: Whether to inherit config from the parent.
  trial_edition: Whether to enable Storage Intelligence for TRIAL edition.
  include_locations: List of locations to be included in the filter.
  exclude_locations: List of locations 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 Intelligence Config object.
r   r   )r   rK   r   rl   r   ra   rh   )	r   organizationrA   rB   rC   rD   rE   rF   rT   s	            r   'update_organization_intelligence_config>StorageIntelligenceApi.update_organization_intelligence_configo  s]    4 $%<I ++!!RR++DD
 
r   )r   r   )NNN)FFNNNN)	NFFNNNNNN)__name__
__module____qualname____firstlineno____doc__r   r0   rH   rK   rU   r\   rc   ri   rm   rr   rv   rz   r~   __static_attributes____classcell__)r   s   @r   r   r      s    ,A  	!0   $ $GV  $ $  DH$I(N(&&,   $ $)\   $ $(Z   $ $( (r   r   N)r   googlecloudsdk.api_lib.utilr   r   r*   rO   r_   rX   strr   r   r   r   r   <module>r      sQ    < 9 , ! - # Ns N N N
x xr   