
                         D   S r SSK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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SKJr  S r " S S\R0                  5      r " S S\R0                  5      r " S S\R0                  5      rS r " S S\5      rS rS r S r!S r"S r#S r$S  r%S! r&S" r'S# r(S$ r)S% r*S& r+S' r,S(\
RZ                  4S) jr.S* r/S+ r0S<S, jr1S=S- jr2S<S. jr3S/ r4S0 r5S1 r6S2\7S(S4S3 jr8S4 r9S5 r:S6 r;S>S7 jr<S8 r=S9 r>S: r?S; r@g)?z0Module for wrangling bigtable command arguments.    N)util)actions)arg_parsers)base)
exceptions)concepts)
completers)	arg_utils)	yaml_data)resource_args)concept_parsers)presentation_specs)textc                      [         R                  " 5       R                  R                  R	                  5        V s/ s H!  n SU ;  d  M  [
        R                  " U 5      PM#     sn $ s  sn f )NUNSPECIFIED)r   GetAdminMessagesCluster NodeScalingFactorValueValuesEnumnamesr
   EnumNameToChoicexs    4lib/googlecloudsdk/command_lib/bigtable/arguments.pyGetValidNodeScalingFactorsr   #   s\     $$&..OOUUW
W!	a	 $i  #W
  
s   
A%A%c                   (   ^  \ rS rSrU 4S jrSrU =r$ )ClusterCompleter+   c                 4   > [         [        U ]
  " SSSS.UD6  g )N)bigtableadmin.projects.instances.clustersz!beta bigtable clusters list --uri
collectionlist_command )superr   __init__selfkwargs	__class__s     r   r%   ClusterCompleter.__init__-   s(    	
D* >8     r#   __name__
__module____qualname____firstlineno__r%   __static_attributes____classcell__r)   s   @r   r   r   +        r+   r   c                   (   ^  \ rS rSrU 4S jrSrU =r$ )InstanceCompleter5   c                 4   > [         [        U ]
  " SSSS.UD6  g )N bigtableadmin.projects.instancesz"beta bigtable instances list --urir    r#   )r$   r6   r%   r&   s     r   r%   InstanceCompleter.__init__7   s(    	
T+ 59 r+   r#   r,   r3   s   @r   r6   r6   5   r4   r+   r6   c                   (   ^  \ rS rSrU 4S jrSrU =r$ )TableCompleter?   c                 4   > [         [        U ]
  " SSSS.UD6  g )N'bigtableadmin.projects.instances.tablesz)beta bigtable instances tables list --urir    r#   )r$   r<   r%   r&   s     r   r%   TableCompleter.__init__A   s'    	.$( <@ r+   r#   r,   r3   s   @r   r<   r<   ?   r4   r+   r<   c                    [         R                  " 5       nU R                  nUR                  R	                  U R
                  5      nU R                  S5      (       d'  X1R                  R                  R                  :X  a  SnU$ X1R                  R                  R                  :X  a  [        R                  " SS5      eUS:  a  [        R                  " SS5      eU$ )a  Ensure that --instance-type and --num-nodes are consistent.

If --instance-type is DEVELOPMENT, then no --cluster-num-nodes can be
specified. If --instance-type is PRODUCTION, then --cluster-num-nodes defaults
to 3 if not specified, but can be any positive value.

Args:
  args: an argparse namespace.

Raises:
  exceptions.InvalidArgumentException: If --cluster-num-nodes is specified
      when --instance-type is DEVELOPMENT, or --cluster-num-nodes is not
      positive.

Returns:
  Number of nodes or None if DEVELOPMENT instance-type.
cluster_num_nodes   --cluster-num-nodesz9Cannot set --cluster-num-nodes for DEVELOPMENT instances.   z;Clusters of PRODUCTION instances must have at least 1 node.)r   r   rB   InstanceTypeValueValuesEnuminstance_typeIsSpecified
PRODUCTIONDEVELOPMENTr   InvalidArgumentException)argsmsgs	num_nodesrH   s       r   ProcessInstanceTypeAndNodesrP   I   s    $ 
			 $$$)--33D4F4FG-			-	.	.99DDDi 
 99EEE//

E  
Q//

G  
r+   c                       \ rS rSrSrS rS rS rS rS r	S r
S	 rS
 rS!S jrS r S"S jrS r S#S jrS#S jrS rS!S\4S jjrS!S\4S jjrS rS rS rS!S jrS rS r     S$S jrS rS rS!S jr S r!g)%ArgAddero   z3A class for adding Bigtable command-line arguments.c                     Xl         g Nparser)r'   rW   s     r   r%   ArgAdder.__init__r   s    Kr+   c                     [         R                  " U[        R                  " 5       R                  R
                  [        5       S9$ )N)valid_choices)r
   ChoiceToEnumr   r   r   r   r   )r'   node_scaling_factors     r   _GetNodeScalingFactorChoice$ArgAdder._GetNodeScalingFactorChoiceu   s6    !!''HH02 r+   c                 X    [         R                  R                  U R                  5        U $ rU   )r   
ASYNC_FLAGAddToParserrW   r'   s    r   AddAsyncArgAdder.AddAsync|   s    OO,Kr+   c                 F    U R                   R                  S[        SSS9  U $ )zAdd cluster argument.	--clusterzID of the cluster.T	completerhelprequired)rW   add_argumentr   rb   s    r   
AddClusterArgAdder.AddCluster   s,    KK"!	   Kr+   c                 r    U R                   R                  S[        SS[        R                  " SSSSS9S9  U $ )z Add deprecated cluster argument.rf   zID of the clusterFEThe {flag_name} argument is deprecated; use --cluster-config instead.storewarnremovedaction)rh   ri   rj   rt   )rW   rk   r   r   DeprecationActionrb   s    r   AddDeprecatedClusterArgAdder.AddDeprecatedCluster   sJ    KK" (( 
   Kr+   c                 r    U R                   R                  SSS[        [        R                  " SSSSS9S9  U $ )z&Add deprecated cluster nodes argument.rD   Number of nodes to serve.Fro   rp   rq   )ri   rj   typert   )rW   rk   intr   ru   rb   s    r   AddDeprecatedClusterNodes"ArgAdder.AddDeprecatedClusterNodes   sJ    KK(((! 
   Kr+   c                 n    [         R                  " SSS/SSS9nUR                  U R                  5        U $ )Nz--cluster-storage-typehddssdzStorage class for the cluster.)choicesdefaulthelp_str)r   ChoiceArgumentra   rW   )r'   storage_arguments     r   AddClusterStorageArgAdder.AddClusterStorage   s<    ** 1	   -Kr+   c                 z    [         R                  " SS[        5       SS9nUR                  U R                  5        U $ )Nz--node-scaling-factorz$Node scaling factor for the cluster.znode-scaling-factor-1x)r   r   r   )r   r   r   ra   rW   )r'   node_scaling_factor_arguments     r   AddClusterNodeScalingFactor$ArgAdder.AddClusterNodeScalingFactor   s;    #'#6#67*,(	$  !,,T[[9Kr+   c                 N    U R                   R                  U(       a  SOSSSS9  U $ )N--cluster-zonez--zone|ID of the zone where the cluster is located. Supported zones are listed at https://cloud.google.com/bigtable/docs/locations.Tri   rj   rW   rk   )r'   in_instances     r   AddClusterZoneArgAdder.AddClusterZone   s3    KK'XN    Kr+   c                 h    U R                   R                  SSS[        R                  " SSSSS9S9  U $ )z%Add deprecated cluster zone argument.r   r   Fro   rp   rq   )ri   rj   rt   rW   rk   r   ru   rb   s    r   AddDeprecatedClusterZone!ArgAdder.AddDeprecatedClusterZone   sL    KKN (( 
  " Kr+   Nc                 t   SR                  [        R                  " U(       a  SOSS5      5      nU(       a  SR                  XT/5      nU(       a  SOSn[        US.nU(       a,  U(       a  SUS	'   OS
n[
        R                  " 5       US'   SUS'   U(       d  X'S'   U R                  R                  " U40 UD6  U $ )z'Add argument for instance ID to parser.zID of the {}.   rE   instance 
--instance)rh   ri   +nargs--instancesrz   INSTANCEmetavarrj   )	formatr   	Pluralizejoinr6   r   ArgListrW   rk   )r'   
positionalrj   multipleadditional_help	help_textnamerM   s           r   AddInstanceArgAdder.AddInstance   s      &&Hq!Z8I ((I78i#:D*I>D	W"**,V$Y!:KKT*T*Kr+   c                 F    U R                   R                  S[        SSS9  U $ )zAdd table argument.--tablezID of the table.Trg   )rW   rk   r<   rb   s    r   AddTableArgAdder.AddTable   s,    KK 	   Kr+   c                 d   U R                   R                  US9nUR                  S5      nUR                  SSSSSS9  UR                  S	[        R
                  " 5       S
SS9  UR                  SSSSS9  UR                  S5      nUR                  S[        SSS9  SnUR                  SSSUS9  U $ )z1Adds arguments for app_profile routing to parser.rj   zMulti Cluster Routing Policyz--route-any
store_trueTFz!Use Multi Cluster Routing policy.)rt   rj   r   ri   z--restrict-toztCluster IDs to route to using the Multi Cluster Routing Policy. If unset, all clusters in the instance are eligible.RESTRICT_TO)rz   ri   r   z--row-affinityNz.Use row-affinity routing for this app profile.rt   r   ri   zSingle Cluster Routing Policyz
--route-toz;Cluster ID to route to using Single Cluster Routing policy.)rh   rj   ri   z@Allow transactional writes with a Single Cluster Routing policy.z--transactional-writes)rW   add_mutually_exclusive_group	add_grouprk   r   r   r   )r'   rj   routing_group	any_grouproute_to_grouptransactional_write_helps         r   AddAppProfileRoutingArgAdder.AddAppProfileRouting  s   
 KK<<h<OM''(FGI0     "D    =	   #,,-LMN"J	    	K   %	    Kr+   c                 Z    U R                   R                  SSR                  U5      US9  U $ )z'Add argument for description to parser.z--descriptionzFriendly name of the {}.r   rW   rk   r   )r'   resourcerj   s      r   AddDescriptionArgAdder.AddDescription6  s4    KK'..x8  
 Kr+   c                 \    U R                   R                  SSSSR                  U5      S9  U $ )z%Add argument for force to the parser.z--forcer   FzIgnore warnings and force {}.r   r   )r'   verbs     r   AddForceArgAdder.AddForce?  s7    KK,33D9	   Kr+   rj   c                 <    U R                   R                  SSUS9  U $ )z*Add argument for view query to the parser.z--queryzThe query of the view.r   r   r'   rj   s     r   AddViewQueryArgAdder.AddViewQueryI  s)    KK%  
 Kr+   c                 f    U R                   R                  S[        R                  " 5       SUSS9  U $ )z3Add argument for deletion protection to the parser.z--deletion-protectionz,Whether the view is protected from deletion.N)rz   ri   rj   r   )rW   rk   r   
ArgBooleanr   s     r   AddDeletionProtectionArgAdder.AddDeletionProtectionR  s8    KK##%;   Kr+   c           	          U R                   R                  S[        R                  " [        [        S.SSS9S[
        R                  " S5      S9  U $ )	z7Add argument for fixed-capacity argument to the parser.z--fixed-capacity)zstorage-size-gibzmax-request-units-per-secondrE   r   )spec
min_length
max_lengthz<[storage-size-gib=SIZE],[max-request-units-per-second=UNITS]a          Specify fixed capacity for memory layer as a key-value dictionary.

        Keys can be:

          *storage-size-gib*: The storage size of the memory layer in GiB.

          *max-request-units-per-second*: The max request units per second that can be served by the memory layer. Once request units reach the configured max request units per second, reads will be throttled and fallback to the backing persistent data store.
        )rz   r   ri   )rW   rk   r   ArgDictr{   textwrapdedentrb   s    r   AddMemoryLayerFixedCapacity$ArgAdder.AddMemoryLayerFixedCapacity^  s[    KK  $'03 
 O__    * Kr+   c                 >    U R                   R                  SSSSS9  U $ )z6Add argument for disabling memory layer to the parser.z	--disabler   Fz)Disable the memory layer for the cluster.r   r   rb   s    r   AddMemoryLayerDisableArgAdder.AddMemoryLayerDisablew  s,    KK8	   Kr+   c           	      0   U R                   R                  5       nUR                  S5      nSSSS.nUR                  SS USS	S
S9  UR                  SSSSS9  UR                  S5      nUR                  SSSSS
S9  SS0nUR                  SS USSS
S9  U $ )z@Add argument for isolating this app profile's traffic to parser.zStandard Isolationz'Requests are treated with low priority.z*Requests are treated with medium priority.z(Requests are treated with high priority.)PRIORITY_LOWPRIORITY_MEDIUMPRIORITY_HIGHz
--priorityc                 B    U R                  SS5      R                  5       $ )N-_)replaceupperr   s    r   <lambda>'ArgAdder.AddIsolation.<locals>.<lambda>  s    qyyc*002r+   Na  Specify the request priority under standard provisioned node compute capabilities. Passing this option implies standard provisioned node compute, e.g. the `--standard` option. If not specified, the app profile uses standard provisioned node compute with PRIORITY_HIGH by default. Specifying request priority on an app profile that has Data Boost serverless compute enabled changes the compute option to standard and uses the specified priority, which might cause unexpected behavior for running applications.T)rz   r   r   ri   rj   z
--standardr   Fz|Use standard provisioned node compute option, rather than Data Boost compute option. If specified, `--priority` is required.r   zData Boost Read-only Isolationz--data-boosta*  Use Data Boost serverless compute option, rather than standard provisioned node compute. If specified, --data-boost-compute-billing-owner is required. Specifying Data Boost compute on an app profile that uses standard provisioned node compute may cause unexpected behavior for running applications.)rt   r   ri   rj   	HOST_PAYSzwCompute billing should be accounted towards the host Cloud project (containing the targeted Bigtable instance / table).z"--data-boost-compute-billing-ownerc                 "    U R                  5       $ rU   r   r   s    r   r   r     
    qwwyr+   zQSpecify the Data Boost compute billing owner, required if --data-boost is passed.)rW   r   r   rk   )r'   isolation_groupstandard_isolation_groupr   data_boost_isolation_groupcompute_billing_choicess         r   AddIsolationArgAdder.AddIsolation  s   kk>>@O.88 
 BGCG
 ))2 ! * & ))M *  "1!:!:(" ++  ,   	L ++, ''  , 
 Kr+   c                 <    U R                   R                  SSUS9  U $ )z.Add argument group for display-name to parser.z--display-namezFriendly name of the instance.r   r   r   s     r   AddInstanceDisplayNameArgAdder.AddInstanceDisplayName  s)    KK-  
 Kr+   c                 z    SSS.nU R                   R                  SSS USS[        R                  " SS	SS
S9S9  U $ )z&Add deprecated instance type argument.zProduction instances provide high availability and are suitable for applications in production. Production instances created with the --instance-type argument have 3 nodes if a value is not provided for --cluster-num-nodes.zDevelopment instances are low-cost instances meant for development and testing only. They do not provide high availability and no service level agreement applies.)rJ   rK   z--instance-typerJ   c                 "    U R                  5       $ rU   r   r   s    r   r   4ArgAdder.AddDeprecatedInstanceType.<locals>.<lambda>  r   r+   zThe type of instance to create.FzzThe {flag_name} argument is deprecated. DEVELOPMENT instances are no longer offered. All instances are of type PRODUCTION.rp   rq   )r   rz   r   ri   rj   rt   r   )r'   r   s     r   AddDeprecatedInstanceType"ArgAdder.AddDeprecatedInstanceType  sd    7!G 	KK .((P 
  " Kr+   c                     U R                   R                  SS[        R                  " [        [        [
        U R                  [        [
        [
        [
        [
        S.	SS/SS9S[        R                  " S	5      S
9  U $ )z5Add the cluster-config argument as repeated kv dicts.z--cluster-configappend)	idzonenodesznode-scaling-factorkms-keyzautoscaling-min-nodeszautoscaling-max-nodeszautoscaling-cpu-targetzautoscaling-storage-targetr   r   	   )r   required_keysr   a  id=ID,zone=ZONE,[nodes=NODES],[node-scaling-factor=NODE_SCALING_FACTOR],[kms-key=KMS_KEY],[autoscaling-min-nodes=AUTOSCALING_MIN_NODES,autoscaling-max-nodes=AUTOSCALING_MAX_NODES,autoscaling-cpu-target=AUTOSCALING_CPU_TARGET,autoscaling-storage-target=AUTOSCALING_STORAGE_TARGET]a          *Repeatable*. Specify cluster config as a key-value dictionary.

        This is the recommended argument for specifying cluster configurations.

        Keys can be:

          *id*: Required. The ID of the cluster.

          *zone*: Required. ID of the zone where the cluster is located. Supported zones are listed at https://cloud.google.com/bigtable/docs/locations.

          *nodes*: The number of nodes in the cluster. Default=1.

          *node-scaling-factor*: The node scaling factor for the cluster. Default=node-scaling-factor-1x. NODE_SCALING_FACTOR must be one of: node-scaling-factor-1x, node-scaling-factor-2x.

          *kms-key*: The Cloud KMS (Key Management Service) cryptokey that will be used to protect the cluster.

          *autoscaling-min-nodes*: The minimum number of nodes for autoscaling.

          *autoscaling-max-nodes*: The maximum number of nodes for autoscaling.

          *autoscaling-cpu-target*: The target CPU utilization percentage for autoscaling. Accepted values are from 10 to 80.

          *autoscaling-storage-target*: The target storage utilization gibibytes per node for autoscaling. Accepted values are from 2560 to 5120 for SSD clusters and 8192 to 16384 for HDD clusters.

        If this argument is specified, the deprecated arguments for configuring a single cluster will be ignored, including *--cluster*, *--cluster-zone*, *--cluster-num-nodes*.

        See *EXAMPLES* section.
        )rt   rz   r   ri   )	rW   rk   r   r   strr{   r]   r   r   rb   s    r   AddClusterConfigArgAdder.AddClusterConfig  s    KK  '+'G'G),),*-.1
  .
 E __  7  8t Kr+   c           	         U R                   R                  US9nUR                  S5      nUR                  SSUU[        SS9  U(       a  UR                  SSS	S
S
S
S9  UR                  SS
S9nUR                  SSSU[        SS9  UR                  SSSU[        SS9  UR                  SSSU[        SS9  UR                  SSSS
[        SS9  U $ )Add scaling related arguments.r   zManual Scalingz--num-nodesry   	NUM_NODES)ri   r   rj   rz   r   z--disable-autoscalingz~Set this flag and --num-nodes to disable autoscaling. If autoscaling is currently not enabled, setting this flag does nothing.r   F)ri   rt   r   rj   hiddenAutoscaling)r  z--autoscaling-min-nodesz,The minimum number of nodes for autoscaling.NAUTOSCALING_MIN_NODESz--autoscaling-max-nodesz,The maximum number of nodes for autoscaling.AUTOSCALING_MAX_NODESz--autoscaling-cpu-targetzYThe target CPU utilization percentage for autoscaling. Accepted values are from 10 to 80.AUTOSCALING_CPU_TARGETz--autoscaling-storage-targetzThe target storage utilization gibibytes per node for autoscaling. Accepted values are from 2560 to 5120 for SSD clusters and 8192 to 16384 for HDD clusters.AUTOSCALING_STORAGE_TARGET)rW   r   r   rk   r{   )	r'   rj   num_nodes_requirednum_nodes_defaultadd_disable_autoscaling&require_all_essential_autoscaling_argsscaling_groupmanual_scaling_groupautoscaling_groups	            r   AddScalingArgsArgAdder.AddScalingArgsA  sA    KK<<h<OM(223CD%%(!# &  ''
!  (  &//e/L""!;7' #  ""!;7' #  """) 7( # 
 ""&* , #  Kr+   c                 $    U R                  SSSS9$ )r  T)rj   r  r  r  rb   s    r   AddScalingArgsForClusterUpdate'ArgAdder.AddScalingArgsForClusterUpdate  s!    $   r+   c                 "    U R                  SSS9$ )r  rC   T)r  r  r  rb   s    r   AddScalingArgsForClusterCreate'ArgAdder.AddScalingArgsForClusterCreate  s    D   r+   c           
          U R                   R                  SS[        R                  " S5      U[        R
                  " 5       [        R                  SS9  U $ )z&Add argument group for tags to parser.z--tagsz	KEY=VALUEaD              List of tags KEY=VALUE pairs to bind.
            Each item must be specified in either ID
            `<tag_key_id>=<tag_value_id>`
            or namespace format
            `<tag-key-namespaced-name>=<tag-value-short-name>`.
            Example: `123/environment=production,123/costCenter=marketing`
        T)r   ri   rj   rz   rt   r  )rW   rk   r   r   r   r   UpdateActionr   s     r   AddTagsArgAdder.AddTags  sT    KK__     "''    Kr+   rV   F)TTFN)T)FFNFF)"r-   r.   r/   r0   __doc__r%   r]   rc   rl   rv   r|   r   r   r   r   r   r   r   r   r   boolr   r   r   r   r   r   r   r  r  r  r  r  r1   r#   r+   r   rR   rR   o   s    ;&&	, MQ0 .`4 	D 	2Tl!F<@ #-2IVr+   rR   c                  ,    [         R                  " SSS9$ )Nr   z%Bigtable instance for the {resource}.r   r   r    ResourceParameterAttributeConfigr#   r+   r   InstanceAttributeConfigr'    s    		2	2!H
 r+   c                  ,    [         R                  " SSS9$ )Ntablez"Bigtable table for the {resource}.r$  r%  r#   r+   r   TableAttributeConfigr*    s    		2	2B
 r+   c                  ,    [         R                  " SSS9$ )Nclusterz$Bigtable cluster for the {resource}.r$  r%  r#   r+   r   ClusterAttributeConfigr-    s    		2	2 F
 r+   c                  ,    [         R                  " SSS9$ )Napp profilez0Bigtable application profile for the {resource}.r$  r%  r#   r+   r   AppProfileAttributeConfigr0    s    		2	2B
 r+   c                  ,    [         R                  " SSS9$ )Nbackupz#Bigtable backup for the {resource}.r$  r%  r#   r+   r   BackupAttributeConfigr3    s    		2	2D
 r+   c                  *    [         R                  " SS9$ )Nr   )r   r%  r#   r+   r   KmsKeyAttributeConfigr5    s    		2	2		BBr+   c                  ,    [         R                  " SSS9$ )Nkms-keyringz%The KMS keyring id of the {resource}.r$  r%  r#   r+   r   KmsKeyringAttributeConfigr8    s    		2	2$K
 r+   c                  ,    [         R                  " SSS9$ )Nkms-locationz&The Cloud location for the {resource}.r$  r%  r#   r+   r   KmsLocationAttributeConfigr;    s    		2	2%M
 r+   c                  ,    [         R                  " SSS9$ )Nkms-projectz(The Cloud project id for the {resource}.r$  r%  r#   r+   r   KmsProjectAttributeConfigr>    s    		2	2$N
 r+   c                  ^    [         R                  " SS[        5       [         R                  SS9$ )z:Return the resource specification for a Bigtable instance.r9   r   Fresource_nameinstancesId
projectsIddisable_auto_completersr   ResourceSpecr'   DEFAULT_PROJECT_ATTRIBUTE_CONFIGr#   r+   r   GetInstanceResourceSpecrH    s-    			()+::#
 r+   c            	      p    [         R                  " SS[        5       [        5       [         R                  SS9$ )z7Return the resource specification for a Bigtable table.r?   r)  F)rA  tablesIdrB  rC  rD  )r   rF  r*  r'  rG  r#   r+   r   GetTableResourceSpecrK    s3    			/#%)+::#
 r+   c            	      p    [         R                  " SS[        5       [        5       [         R                  SS9$ )z9Return the resource specification for a Bigtable cluster.r   r,  F)rA  
clustersIdrB  rC  rD  )r   rF  r-  r'  rG  r#   r+   r   GetClusterResourceSpecrN    s3    			1'))+::#
 r+   c                  ^    [         R                  " SS[        5       [         R                  SS9$ )z=Return the resource specification for a Bigtable app profile.z,bigtableadmin.projects.instances.appProfilesr/  Fr@  rE  r#   r+   r   GetAppProfileResourceSpecrP    s-    			4!)+::#
 r+   c                  ^    [         R                  " SS[        5       [         R                  SS9$ )z>Return the resource specification for a Bigtable logical view.z-bigtableadmin.projects.instances.logicalViewszlogical viewFr@  rE  r#   r+   r   GetLogicalViewResourceSpecrR    s-    			5")+::#
 r+   returnc                  ^    [         R                  " SS[        5       [         R                  SS9$ )zCReturn the resource specification for a Bigtable materialized view.z2bigtableadmin.projects.instances.materializedViewszmaterialized viewFr@  rE  r#   r+   r   GetMaterializedViewResourceSpecrU    s-    			:')+::#
 r+   c            
      v    [         R                  " SS[        5       [        5       [	        5       [        5       SS9$ )Nz/cloudkms.projects.locations.keyRings.cryptoKeyskeyF)rA  cryptoKeysId
keyRingsIdlocationsIdrC  rD  )r   rF  r5  r8  r;  r>  r#   r+   r   GetKmsKeyResourceSpecr[  '  s6    			7(**,,.*,#
 r+   c            
          [         R                  " SS[        5       [        5       [	        5       [         R
                  SS9$ )Nz1bigtableadmin.projects.instances.clusters.backupsr2  F)rA  	backupsIdrM  rB  rC  rD  )r   rF  r3  r-  r'  rG  r#   r+   r   GetBackupResourceSpecr^  3  s9    			9%''))+::#
 r+   c                     [         R                  R                  U(       a  SOS[        5       SR	                  U5      USS9R                  U 5        g)z0Add --instances resource argument to the parser.r   r   zThe instances {}.Trj   pluralNr   ConceptParserForResourcerH  r   ra   rW   r   r   s      r   AddInstancesResourceArgrf  ?  sH    ++jM  & ,  Kr+   c                     [         R                  R                  U(       a  SOS[        5       SR	                  U5      USS9R                  U 5        g)z/Add --instance resource argument to the parser.r   r   The instance {}.Fr`  Nrb  )rW   r   r   rj   s       r   AddInstanceResourceArgri  J  sH    ++jL% ,  Kr+   c                     [         R                  R                  U(       a  SOS[        5       SR	                  U5      SSS9R                  U 5        g)z,Add --table resource argument to the parser.r)  r   zThe table {}.TFr`  N)r   rc  rd  rK  r   ra   re  s      r   AddTableResourceArgrk  U  sH    ++gT" ,  Kr+   c                     [         R                  R                  S[        5       SR	                  U5      SS9R                  U 5        g)z7Add cluster positional resource argument to the parser.r,  The cluster {}.Tr   N)r   rc  rd  rN  r   ra   rW   r   s     r   AddClusterResourceArgro  `  sA    ++t$	 , 
 Kr+   c                     [         R                  R                  S[        5       SR	                  U5      SS9R                  U 5        g)z;Add app profile positional resource argument to the parser.app_profilezThe app profile {}.Tr   N)r   rc  rd  rP  r   ra   rn  s     r   AddAppProfileResourceArgrr  j  sA    ++!""4(	 , 
 Kr+   c                 z    [         R                  R                  S[        5       SU S3SS9R	                  U 5        g)z<Add logical view positional resource argument to the parser.logical_viewzThe logical view .Tr   N)r   rc  rd  rR  ra   rn  s     r   AddLogicalViewResourceArgrv  t  s?    ++ "$q!	 , 
 Kr+   r   c                 z    [         R                  R                  S[        5       SU S3SS9R	                  U 5        g)zAAdd materialized view positional resource argument to the parser.materialized_viewzThe materialized view ru  Tr   N)r   rc  rd  rU  ra   rn  s     r   AddMaterializedViewResourceArgry  ~  s?    ++%'tfA&	 , 
 Kr+   c                     [         R                  " 5       nUR                  R                  n[        R
                  " SUSSSS.SSS9nUR                  R                  U 5        g)	z$Add argument for view to the parser.z--viewschemareplicationfull)SCHEMA_VIEWREPLICATION_VIEWFULLz<Specifies what type of information to return about the view.)custom_mappingsr   r   N)r   r   9BigtableadminProjectsInstancesMaterializedViewsGetRequestViewValueValuesEnumr
   ChoiceEnumMapper
choice_argra   )rW   rN   view_enum_typemappers       r   AddViewOverMaterializedViewr    si    				 $
DDXX  %%!+
 N
& 	'r+   c                    [         R                  " [        R                  " S[	        5       SR                  U5      SS9[        R                  " S[        5       SR                  U5      SSS0S	9/5      R                  U 5        g
)z6Add backup positional resource argument to the parser.r   rh  Fr   rf   rm  r    rj   flag_name_overridesN)r   rc  r   ResourcePresentationSpecrH  r   rN  ra   rn  s     r   AddBackupResourceArgr    s{    11

!
#

#
#D
)	 11

 
"

"
"4
()2.!  [r+   c                    [         R                  R                  S5      n[         R                  R                  S5      n[        R                  " SSSSSS0SUR                  5       S9[        R                  " S	S
SSSS
0SUR                  5       S9/nS/S/S.n[        R                  " X45      R                  U 5        g)zBAdd Table resource args (source, destination) for restore command.zbigtable.tablezbigtable.backupzto restore fromsourceTr2  F)r   r   rj   prefixesattribute_overridesr   resource_datazto restore todestinationr)  --destination.instance--source.instance)r  r  N)	r   ResourceYAMLDataFromPathr   GetResourcePresentationSpecGetDatar   rc  ra   )rW   table_spec_databackup_spec_data	arg_specsfallthroughss        r   AddTableRestoreResourceArgr    s    ..778HI///889JK // '2(002 //&6'//1)* 55!4 5, 	8DDVLr+   c                     [         R                  R                  S[        5       SR	                  U5      UUS9R                  U 5        g)a  Add a resource argument for a KMS key.

Args:
  parser: the parser for the command.
  resource: str, the name of the resource that the cryptokey will be used to
    protect.
  flag_overrides: dict, The default flag names are 'kms-key', 'kms-keyring',
    'kms-location' and 'kms-project'. You can pass a dict of overrides where
    the keys of the dict are the default flag names, and the values are the
    override names.
  required: bool, optional. True if the flag must be parsable by the parser.
z	--kms-keyzUThe Cloud KMS (Key Management Service) cryptokey that will be used to protect the {}.)r  rj   N)r   rc  rd  r[  r   ra   )rW   r   flag_overridesrj   s       r   AddKmsKeyResourceArgr    sG     ++x(( ,  Kr+   c                     U R                   R                  R                  5       nU(       a  UR                  5       $ S H;  n[	        XR                  SS5      S5      (       d  M&  [        R                  " SS5      e   g)zDParse the KMS key resource arg, make sure the key format is correct.)r   r7  r:  r=  r   r   Nz4--kms-project --kms-location --kms-keyring --kms-keyzSpecify fully qualified KMS key ID with --kms-key, or use combination of --kms-project, --kms-location, --kms-keyring and --kms-key to specify the key ID in pieces.)CONCEPTSkms_keyParseRelativeNamegetattrr   r   rL   )rM   kms_refkeywords      r   GetAndValidateKmsKeyNamer    sr    MM!!'')'!! M	sC0$	7	711B;
 	
 M r+   c                 v    U R                  SS[        R                  R                  SR	                  U5      S9  g )Nz--start-timeFz^Start time of the time range {}. See $ gcloud topic datetimes for information on time formats.rj   rz   ri   rk   r   Datetimer  r   rn  s     r   AddStartTimeArgsr    s9    %%J6$<  	r+   c                 v    U R                  SS[        R                  R                  SR	                  U5      S9  g )Nz
--end-timeFz\End time of the time range {}. See $ gcloud topic datetimes for information on time formats.r  r  rn  s     r   AddEndTimeArgsr    s9    %%J6$<  	r+   c                     [         R                  " S[        5       SSSSSSS.S	9[         R                  " S
[        5       SSSSSSS.S	9/nS/S/S/S/S.n[        R                  " X5      R                  U 5        g)z@Add backup resource args (source, destination) for copy command.z--sourcezThe source backup to copy from.Tz--source-projectz--source-instancez--source-clusterz--source-backup)projectr   r,  r2  r  z--destinationz"The destination backup to copy to.z--destination-projectz--destination-instancez--destination-clusterz--destination-backup--destination.project--source.projectr  r  )r  r  r  r  N)r   r  r^  r   rc  ra   )rW   r  r  s      r   AddCopyBackupResourceArgsr    s     11


!
++-+)	 11


!
.020.	)6 33 2345!4 5	, 	8DDVLr+   r   )FT)NF)Ar!  r   googlecloudsdk.api_lib.bigtabler   googlecloudsdk.callioper   r   r   r    googlecloudsdk.calliope.conceptsr   googlecloudsdk.command_lib.utilr	   $googlecloudsdk.command_lib.util.apisr
   r   $googlecloudsdk.command_lib.util.argsr   (googlecloudsdk.command_lib.util.conceptsr   r   googlecloudsdk.core.utilr   r   ListCommandCompleterr   r6   r<   rP   objectrR   r'  r*  r-  r0  r3  r5  r8  r;  r>  rH  rK  rN  rP  rR  rF  rU  r[  r^  rf  ri  rk  ro  rr  rv  r   ry  r  r  r  r  r  r  r  r  r#   r+   r   <module>r     sC   7  0 + / ( . 5 6 : : > D G )z66 
77 Z44 #L{v {|C
		)>)> 		  ((&M@.$

"Mr+   