
    0                         S r SSKJr  SSKJr  SSKJr  S rS rSS jr	      SS	 jr
           SS
 jr           SS jrg)z!Bigtable app-profiles API helper.    )
list_pager)util)
exceptionsc                     [         R                  " 5       n[         R                  " 5       R                  U R	                  5       S9nUR
                  R                  U5      $ )zDescribe an app profile.

Args:
  app_profile_ref: A resource reference to the app profile to describe.

Returns:
  App profile resource object.
)name)r   GetAdminClientGetAdminMessages3BigtableadminProjectsInstancesAppProfilesGetRequestRelativeNameprojects_instances_appProfilesGet)app_profile_refclientmsgs      3lib/googlecloudsdk/api_lib/bigtable/app_profiles.pyDescriber      sV      &SS'') 	T 	# 
	.	.	2	23	77    c                     [         R                  " 5       n[         R                  " 5       R                  U R	                  5       S9n[
        R                  " UR                  USSS9$ )zList app profiles.

Args:
  instance_ref: A resource reference of the instance to list app profiles for.

Returns:
  Generator of app profile resource objects.
)parentappProfilesN)fieldbatch_size_attribute)r   r   r	   4BigtableadminProjectsInstancesAppProfilesListRequestr   r   YieldFromListr   )instance_refr   r   s      r   Listr   '   sd      &TT&&( 	U 	# 
	!	!++		
 r   c                     [         R                  " 5       n[         R                  " 5       R                  U R	                  5       US9nUR
                  R                  U5      $ )zDelete an app profile.

Args:
  app_profile_ref: A resource reference to the app profile to delete.
  force: bool, Whether to ignore API warnings and delete forcibly.

Returns:
  Empty response.
)r   ignoreWarnings)r   r   r	   6BigtableadminProjectsInstancesAppProfilesDeleteRequestr   r   Delete)r   forcer   r   s       r   r    r    <   sX      &VV'')% 	W 	# 
	.	.	5	5c	::r   Nc                    U(       a  U (       a  [         R                  " SS5      eU(       d   U (       d  [         R                  " SS/S5      eU(       a  U(       a  [         R                  " SS5      eU (       a  U(       a  [         R                  " SS5      eU (       a  U(       a  [         R                  " SS5      eU(       a  U(       a  [         R                  " SS5      eU(       a  U(       a  [         R                  " SS5      egg)	ay  Create an app profile.

Args:
  cluster: string, The cluster id for the new app profile to route to using
    single cluster routing.
  multi_cluster: bool, Whether this app profile should route to multiple
    clusters, instead of single cluster.
  restrict_to: list[string] The list of cluster ids for the new app profile to
    route to using multi cluster routing.
  transactional_writes: bool, Whether this app profile has transactional
    writes enabled. This is only possible when using single cluster routing.
  row_affinity: bool, Whether to use row affinity sticky routing.
  data_boost: bool, If the app profile should use Data Boost Read-only
    Isolation.

Raises:
  ConflictingArgumentsException:
      If both cluster and multi_cluster are present.
      If both multi_cluster and transactional_writes are present.
      If both cluster and row_affinity are present.
      If both cluster and restrict_to are present.
      If both multi_cluster and data_boost are present.
      If both transactional_writes and data_boost are present.

  OneOfArgumentsRequiredException: If neither cluster or multi_cluster are
      present.
z
--route-toz--route-anyz3Either --route-to or --route-any must be specified.z--transactional-writesz--row-affinityz--restrict-toz--data-boostN)r   ConflictingArgumentsExceptionOneOfArgumentsRequiredExceptionclustermulti_clusterrestrict_totransactional_writesrow_affinity
data_boosts         r   _AppProfileChecksr,   M   s    F w

2
2<
OO	w

4
4	}%= 
 +

2
2/  

2
2&  

2
2o 
 z

2
2~  j

2
2 .  )r   c           
         [        UUUUUU	S9  [        R                  " 5       n[        R                  " 5       nU R	                  5       nSnSnU(       a1  UR                  U=(       d    / U(       a  UR                  5       OSS9nOU(       a  UR                  UUS9nSnSnU(       d  U(       aN  U(       a  UR                  R                  U5      OSnU(       a  UR                  5       OSnUR                  UUS9nO1U	(       a*  UR                  R                  U
5      nUR                  US9nUR                  UR                  UUUUUS9U R                  5       UR!                  5       US9nUR"                  R%                  U5      $ )	a  Create an app profile.

Args:
  app_profile_ref: A resource reference of the new app profile.
  cluster: string, The cluster id for the new app profile to route to using
    single cluster routing.
  description: string, A description of the new app profile.
  multi_cluster: bool, Whether this app profile should route to multiple
    clusters, instead of single cluster.
  restrict_to: list[string] The list of cluster ids for the new app profile to
    route to using multi cluster routing.
  transactional_writes: bool, Whether this app profile has transactional
    writes enabled. This is only possible when using single cluster routing.
  row_affinity: bool, Whether to use row affinity sticky routing.
  priority: string, The request priority of the new app profile.
  use_memory_layer: bool, Whether to use the memory layer.
  data_boost: bool, If the app profile should use Data Boost.
  data_boost_compute_billing_owner: string, The compute billing owner for Data
    Boost.
  force: bool, Whether to ignore API warnings and create forcibly.

Raises:
  ConflictingArgumentsException,
  OneOfArgumentsRequiredException:
    See _AppProfileChecks(...)

Returns:
  Created app profile resource object.
r%   N
clusterIdsrowAffinity	clusterIdallowTransactionalWrites)prioritymemoryConfigcomputeBillingOwner)descriptionmultiClusterRoutingUseAnysingleClusterRoutingstandardIsolationdataBoostIsolationReadOnly)
appProfileappProfileIdr   r   )r,   r   r   r	   ParentMultiClusterRoutingUseAnyRowAffinitySingleClusterRoutingStandardIsolationPriorityValueValuesEnumMemoryConfigDataBoostIsolationReadOnly"ComputeBillingOwnerValueValuesEnum6BigtableadminProjectsInstancesAppProfilesCreateRequest
AppProfileNamer   r   Create)r   r&   r8   r'   r(   r)   r*   r4   use_memory_layerr+    data_boost_compute_billing_ownerr!   r   msgsr   multi_cluster_routingsingle_cluster_routingstandard_isolationdata_boost_isolationpriority_enummemory_configdata_boost_enumr   s                          r   rK   rK      s   V !/  &				 $ ''), ::$"*6D$$&D ;  !66!5 7 
 !  	66x@ 
 ,<D%%'M//" 0  ''JJ,	
 
  ::+ ;  	CC!$95.%9 !  #'')&&( 	D 	# 
	.	.	5	5c	::r   c           	         [        UUUUUU	S9  [        R                  " 5       n[        R                  " 5       n/ nUR	                  5       nU(       a;  UR                  S5        Ub  UR                  S5        UR                  UUS9Ul        OU(       a  U(       a  UR                  S5        Ub  UR                  S5        UR                  U=(       d    / U(       a  UR                  5       OSS9Ul
        UR                  UR                  5       :X  a  UR                  S	5        U(       a  UR                  S
5        X/l        Uc  Ub  UR                  5       Ul        U(       a;  UR                  R                  U5      UR                  l        UR                  S5        Ub9  U(       a  UR!                  5       OSUR                  l        UR                  S5        OGU	(       a@  UR$                  R'                  U
5      nUR                  S5        UR%                  US9Ul        UR+                  UU R-                  5       SR/                  U5      US9nUR0                  R3                  U5      $ )a  Update an app profile.

Args:
  app_profile_ref: A resource reference of the app profile to update.
  cluster: string, The cluster id for the app profile to route to using single
    cluster routing.
  description: string, A description of the app profile.
  multi_cluster: bool, Whether this app profile should route to multiple
    clusters, instead of single cluster.
  restrict_to: list[string] The list of cluster IDs for the app profile to
    route to using multi cluster routing.
  transactional_writes: bool, Whether this app profile has transactional
    writes enabled. This is only possible when using single cluster routing.
  row_affinity: bool, Whether to use row affinity sticky routing. If None,
    then no change should be made.
  priority: string, The request priority of the new app profile.
  use_memory_layer: bool, Whether to use the memory layer. If None, then no
    change should be made.
  data_boost: bool, If the app profile should use Data Boost.
  data_boost_compute_billing_owner: string, The compute billing owner for Data
    Boost.
  force: bool, Whether to ignore API warnings and create forcibly.

Raises:
  ConflictingArgumentsException,
  OneOfArgumentsRequiredException:
    See _AppProfileChecks(...)

Returns:
  Long running operation.
r%   zsingleClusterRouting.clusterIdNz-singleClusterRouting.allowTransactionalWritesr1   z$multiClusterRoutingUseAny.clusterIdsz%multiClusterRoutingUseAny.rowAffinityr.   r9   r8   zstandardIsolation.priorityzstandardIsolation.memoryConfigr<   r6   ,)r=   r   
updateMaskr   )r,   r   r   r	   rI   appendrB   r:   r@   rA   r9   r8   rC   r;   rD   r4   rE   r5   rF   rG   r<   5BigtableadminProjectsInstancesAppProfilesPatchRequestr   joinr   Patch)r   r&   r8   r'   r(   r)   r*   r4   rL   r+   rM   r!   r   rN   changed_fieldsapp_profilerU   r   s                     r   Updater_      sY   Z !/  &				 $.!+:;'KL'+'@'@!5 (A (K$ BCCD,0,J,J$"*6D$$&D -K -K) 	--))+	, 78-()-9$($:$:$<K!

 
 
8
8
B ##, 89#!1$


t ##0 <=''JJ,	
 
 67-1-L-L+ .M .K* 	BB'').)	 	C 	# 
	.	.	4	4S	99r   )F)NFNNFF)N FNNFNNFNF)Nr`   FNNNNNFNF)__doc__apitools.base.pyr   googlecloudsdk.api_lib.bigtabler   googlecloudsdk.callioper   r   r   r    r,   rK   r_    r   r   <module>rf      s    ( ( 0 .8 *;$ @J %)
i;\ %)
w:r   