
    "                        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d
lmZ ddlmZ ej"                   ej$                  ej&                  j(                         G d dej*                                      Z ej$                  ej&                  j.                         G d de             Z ej$                  ej&                  j2                         G d de             Zy)z%bigtable app profiles update command.    )absolute_import)division)unicode_literalsN)	HttpError)app_profiles)util)base)	arguments)logc                   T    e Zd ZdZd ej
                  d      iZed        Zd Z	d Z
y)UpdateAppProfileUpdate a Bigtable app profile.EXAMPLESa            To update an app profile to use a multi-cluster routing policy, run:

            $ {command} my-app-profile-id --instance=my-instance-id --route-any

          To update an app profile to use a single-cluster routing policy that
          routes all requests to `my-cluster-id` and allows transactional
          writes, run:

            $ {command} my-app-profile-id --instance=my-instance-id --route-to=my-cluster-id --transactional-writes

          To update the description for an app profile, run:

            $ {command} my-app-profile-id --instance=my-instance-id --description="New description"

          To update the request priority for an app profile to PRIORITY_LOW, run:

            $ {command} my-app-profile-id --instance=my-instance-id --priority=PRIORITY_LOW

          To update an app profile to enable row-affinity routing, run:

            $ {command} my-app-profile-id --instance=my-instance-id --route-any --row-affinity

          To update an app profile to enable Data Boost which bills usage to the host project, run:

            $ {command} my-app-profile-id --instance=my-instance-id --data-boost --data-boost-compute-billing-owner=HOST_PAYS

          c                     t        j                  | d       t        j                  |       j                  dd      j	                  d      j                         j                  d      j                          y Nz	to updatezapp profileF)requiredupdater
   AddAppProfileResourceArgArgAdderAddDescriptionAddAppProfileRoutingAddIsolationAddForceAddAsyncparsers    +lib/surface/bigtable/app_profiles/update.pyArgszUpdateAppProfile.ArgsC   T    &&v{;6"		6		u		-		(		    c                 
   t        j                  ||j                  |j                  |j                  |j
                  |j                  |j                  |j                  |j                  |j                  |j                        S a  Updates an AppProfile with the given arguments.

    Args:
      app_profile_ref: A resource reference of the new app profile.
      args: an argparse namespace. All the arguments that were provided to this
        command invocation.

    Raises:
      ConflictingArgumentsException,
      OneOfArgumentsRequiredException:
        See app_profiles.Update(...)

    Returns:
      Long running operation.
    )
clusterdescriptionmulti_clusterrestrict_totransactional_writesrow_affinitypriority
data_boost data_boost_compute_billing_ownerforcer   Updateroute_tor%   	route_anyr'   r(   r)   r*   r+   r,   r-   selfapp_profile_refargss      r   _UpdateAppProfilez"UpdateAppProfile._UpdateAppProfileO   j      $$nn$$!66&&??)-)N)Njj r!   c                    |j                   j                  j                         }	 | j                  ||      }t	        j
                  |      }|j                  r7t        j                  |dj                  |j                               d       |S t	        j                  |dj                  |j                                     S # t        $ r}t	        j                  |       Y d}~yd}~ww xY w)aW  This is what gets called when the user runs this command.

    Args:
      args: an argparse namespace. All the arguments that were provided to this
        command invocation.

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

    Returns:
      Updated resource.
    zbigtable app profile {0}T)kindis_asyncz!Updating bigtable app profile {0}N)CONCEPTSapp_profileParser6   r   GetOperationRefasync_r   UpdatedResourceformatNameAwaitAppProfiler   FormatErrorMessages)r3   r5   r4   resultoperation_refes         r   RunzUpdateAppProfile.Runm   s     mm//557O%%ot<f **62m	+22?3G3G3IJ	

 !!

-
4
4_5I5I5K
L   "
q!!"s   C 	C+C&&C+N)__name__
__module____qualname____doc__textwrapdedentdetailed_helpstaticmethodr   r6   rH    r!   r   r   r      sC     ' /(// # -> 	 	<"r!   r   c                   N    e Zd ZdZd ej
                  d      iZed        Zd Z	y)UpdateAppProfileBetar   r   a            To update an app profile to use a multi-cluster routing policy, run:

            $ {command} my-app-profile-id --instance=my-instance-id --route-any

          To update an app profile to use a single-cluster routing policy that
          routes all requests to `my-cluster-id` and allows transactional
          writes, run:

            $ {command} my-app-profile-id --instance=my-instance-id --route-to=my-cluster-id --transactional-writes

          To update the description for an app profile, run:

            $ {command} my-app-profile-id --instance=my-instance-id --description="New description"

          To update the request priority for an app profile to PRIORITY_LOW, run:

            $ {command} my-app-profile-id --instance=my-instance-id --priority=PRIORITY_LOW

          To update an app profile to enable Data Boost which bills usage to the host project, run:

            $ {command} my-app-profile-id --instance=my-instance-id --data-boost --data-boost-compute-billing-owner=HOST_PAYS

          To update an app profile to enable row-affinity routing, run:

            $ {command} my-app-profile-id --instance=my-instance-id --route-any --row-affinity

          c                     t        j                  | d       t        j                  |       j                  dd      j	                  d      j                         j                  d      j                          y r   r   r   s    r   r   zUpdateAppProfileBeta.Args   r    r!   c                 
   t        j                  ||j                  |j                  |j                  |j
                  |j                  |j                  |j                  |j                  |j                  |j                        S r#   r.   r2   s      r   r6   z&UpdateAppProfileBeta._UpdateAppProfile   r7   r!   N)
rI   rJ   rK   rL   rM   rN   rO   rP   r   r6   rQ   r!   r   rS   rS      s<    & /(// # -> 	 	r!   rS   c                   &    e Zd ZdZed        Zd Zy)UpdateAppProfileAlphar   c                     t        j                  | d       t        j                  |       j                  dd      j	                  d      j                         j                  d      j                          y r   r   r   s    r   r   zUpdateAppProfileAlpha.Args   s[    &&v{;6"		6		 
 

 
	(		r!   c                 
   t        j                  ||j                  |j                  |j                  |j
                  |j                  |j                  |j                  |j                  |j                  |j                        S r#   r.   r2   s      r   r6   z'UpdateAppProfileAlpha._UpdateAppProfile   r7   r!   N)rI   rJ   rK   rL   rP   r   r6   rQ   r!   r   rW   rW      s    & r!   rW   )rL   
__future__r   r   r   rM   apitools.base.py.exceptionsr   googlecloudsdk.api_lib.bigtabler   r   googlecloudsdk.callioper	   #googlecloudsdk.command_lib.bigtabler
   googlecloudsdk.corer   DefaultUniverseOnlyReleaseTracksReleaseTrackGACreateCommandr   BETArS   ALPHArW   rQ   r!   r   <module>rg      s    , &  '  1 8 0 ( 9 # D%%(()nt)) n * nb D%%**+J+ J ,JZ D%%++,-0 - --r!   