
    .                         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 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.    )absolute_import)division)unicode_literals)
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/   P   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(       a+  UR                  R                  U5      nUR                  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.
  data_boost: bool, If the app profile should use Standard Isolation.
  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computeBillingOwner)descriptionmultiClusterRoutingUseAnysingleClusterRoutingstandardIsolationdataBoostIsolationReadOnly)
appProfileappProfileIdr   r!   )r/   r   r   r   ParentMultiClusterRoutingUseAnyRowAffinitySingleClusterRoutingStandardIsolationPriorityValueValuesEnumDataBoostIsolationReadOnly"ComputeBillingOwnerValueValuesEnum6BigtableadminProjectsInstancesAppProfilesCreateRequest
AppProfileNamer   r   Create)r   r)   r;   r*   r+   r,   r-   r8   r.    data_boost_compute_billing_ownerr$   r   msgsr   multi_cluster_routingsingle_cluster_routingstandard_isolationdata_boost_isolationpriority_enumdata_boost_enumr   s                        r   rM   rM      s   R !/  &				 $ ''), ::$"*6D$$&D ;  !66!5 7 
 **BB8LM///G''JJ,	
 
  ::+ ;  	CC!$95.%9 !  #'')&&( 	D 	# 
	.	.	5	5c	::r   c           	      6   [        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(       aA  UR                  R                  U5      nUR                  S5        UR                  US9Ul        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R*                  R-                  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.
  data_boost: bool, If the app profile should use Standard Isolation.
  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.allowTransactionalWritesr4   z$multiClusterRoutingUseAny.clusterIdsz%multiClusterRoutingUseAny.rowAffinityr1   r<   r;   zstandardIsolation.priorityr7   r?   r9   ,)r@   r
   
updateMaskr!   )r/   r   r   r   rK   appendrE   r=   rC   rD   r<   r;   rF   rG   r>   rH   rI   r?   5BigtableadminProjectsInstancesAppProfilesPatchRequestr   joinr   Patch)r   r)   r;   r*   r+   r,   r-   r8   r.   rN   r$   r   rO   changed_fieldsapp_profilerT   rU   r   s                     r   Updater_      s   T !/  &				 $.!+:;'KL'+'@'@!5 (A (K$ BCCD,0,J,J$"*6D$$&D -K -K) 	--))+	, 78-()**BB8LM67$($:$: %; %K! ''JJ,	
 
 67-1-L-L+ .M .K* 	BB'').)	 	C 	# 
	.	.	4	4S	99r   )F)NFNNFF)
N FNNFNFNF)
Nr`   FNNNNFNF)__doc__
__future__r   r   r   apitools.base.pyr   googlecloudsdk.api_lib.bigtabler   googlecloudsdk.callioper   r   r   r#   r/   rM   r_    r   r   <module>rg      s    ( &  ' ' 0 .8 *;$ @J %)
_;H %)
n:r   