
    C*                         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rSr	S	R                  \\	S
9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 rS rS rS rS rS rS r S  r!g!)"zHFlags and helpers for the connection profiles cloudsql related commands.    )absolute_import)division)unicode_literals)arg_parsers)basez"(25[0-5]|2[0-4][0-9]|1?[0-9]{1,2})z([0-9]|[1-2][0-9]|3[0-2])z2{addr_part}(\.{addr_part}){{3}}(\/{prefix_part})?$)	addr_partprefix_partc                 `    U R                  SSS9n[        X15        U(       a  [        U5        gg)z4Adds the database version flags to the given parser.T)requiredmutexN)	add_groupAddDatabaseVersionFlagAddDatabaseVersionNameFlag)parsersupport_new_versionssupport_version_namedatabase_version_groups       Wlib/googlecloudsdk/command_lib/database_migration/connection_profiles/cloudsql_flags.pyAddDatabaseVersionGroupr       s4     "++T+F/F56     c                 H    Sn/ SQnU(       d  / SQnU R                  SX#SS9  g)z3Adds a --database-version flag to the given parser.z*    Database engine type and version.
    )	MYSQL_5_7	MYSQL_5_6	MYSQL_8_0MYSQL_8_0_18MYSQL_8_0_26MYSQL_8_0_27MYSQL_8_0_28MYSQL_8_0_30MYSQL_8_0_31MYSQL_8_0_32MYSQL_8_0_33MYSQL_8_0_34MYSQL_8_0_35MYSQL_8_0_36MYSQL_8_0_37	MYSQL_8_4POSTGRES_9_6POSTGRES_10POSTGRES_11POSTGRES_12POSTGRES_13POSTGRES_14POSTGRES_15POSTGRES_16)
r   r   r   r(   r)   r*   r+   r,   r-   r.   z--database-versionF)helpchoicesr   Nadd_argument)r   r   	help_textr1   s       r   r   r   )   s8    )'4 
G 	e  r   c                 *    SnU R                  SUSS9  g)z8Adds a --database-version-name flag to the given parser.z(Database version name (e.g. POSTGRES_15)z--database-version-nameFr0   r   Nr2   r   r4   s     r   r   r   [   s    8)/i%Pr   c                 R    SnU R                  SS[        R                  " 5       US9  g)z.Adds a --user-labels flag to the given parser.z    The resource labels for a Cloud SQL instance to use to annotate any related
    underlying resources such as Compute Engine VMs. An object containing a list
    of "key": "value" pairs.
    z--user-labelsz	KEY=VALUE)metavartyper0   Nr3   r   ArgDictr7   s     r   AddUserLabelsFlagr=   a   s3    )
 	 	  r   c                 *    SnU R                  SUSS9  g)z'Adds a --tier flag to the given parser.a      Tier (or machine type) for this instance, for example: ``db-n1-standard-1''
    (MySQL instances) or ``db-custom-1-3840'' (PostgreSQL instances). For more
    information, see
    [Cloud SQL Instance Settings](https://cloud.google.com/sql/docs/mysql/instance-settings).
    z--tierTr6   Nr2   r7   s     r   AddTierFlagr?   o   s     ) 	hY>r   c                 \    [         R                  " SSSSS.SSS9nUR                  U 5        g)	z*Adds a --edition flag to the given parser.z	--editionFz8Enterprise is the standard option for smaller instances.zsEnterprise plus option recommended for cpu-intensive workloads. Offers access to premium features and capabilities.)
enterprisezenterprise-plusNzSpecifies edition.)r   r1   defaulthelp_str)r   ChoiceArgumentAddToParser)r   edition_flags     r   AddEditionFlagrG   z   sA    $$ ID #, 6"r   c                 2    SnU R                  S[        US9  g)z<Adds a --storage-auto-resize-limit flag to the given parser.z    Maximum size to which storage capacity can be automatically increased. The
    default value is 0, which specifies that there is no limit.
    z--storage-auto-resize-limitr:   r0   Nr3   intr7   s     r   AddStorageAutoResizeLimitFlagrL      s!    ) 	3#INr   c                 0    SnSS/nU R                  SXS9  g)z4Adds a --activation-policy flag to the given parser.aS      Activation policy specifies when the instance is activated; it is
    applicable only when the instance state is 'RUNNABLE'. Valid values:

    ALWAYS: The instance is on, and remains so even in the absence of
    connection requests.

    NEVER: The instance is off; it is not activated, even if a connection
    request arrives.
    ALWAYSNEVERz--activation-policyr0   r1   Nr2   r   r4   r1   s      r   AddActivationPolicylagrR      s)    	) w'+)Mr   c                 .    SnU R                  SUSSSS9  g)z/Adds a --enable-ip-v4 flag to the given parser.z?Whether the instance should be assigned an IPv4 address or not.z--enable-ip-v4
store_trueenable_ip_v4Tr0   actiondestrB   Nr2   r7   s     r   AddEnableIpv4FlagrY      s)    O)  r   c                 (    SnU R                  SUS9  g)z2Adds a --private-network flag to the given parser.z    Resource link for the VPC network from which the Cloud SQL instance is
    accessible for private IP. For example,
    /projects/myProject/global/networks/default. This setting can be updated,
    but it cannot be removed after it is set.
    z--private-networkr0   Nr2   r7   s     r   AddPrivateNetworkFlagr\      s    ) 	)	:r   c                 .    SnU R                  SUSSSS9  g)z.Adds a --require-ssl flag to the given parser.z:Whether SSL connections over IP should be enforced or not.z--require-sslrT   require_sslFrV   Nr2   r7   s     r   AddRequireSslFlagr_      s)    J)  r   c                     [         R                  " [        S5      nSnU R                  S[         R                  " SUS9S/ US9  g)	z$Adds a `--authorized-networks` flag.z[Must be specified in CIDR notation, also known as 'slash' notation (e.g. 192.168.100.0/24).z    List of external networks that are allowed to connect to the instance.
    Specify values in CIDR notation, also known as 'slash' notation
    (e.g.192.168.100.0/24).
    z--authorized-networks   )
min_lengthelement_typeNETWORK)r:   r9   rB   r0   N)r   RegexpValidator_CIDR_REGEXr3   ArgList)r   cidr_validatorr4   s      r   AddAuthorizedNetworksFlagri      sT    .. BD.)
 	!.I  r   c                 .    SnU R                  SUSSSS9  g)z8Adds a --auto-storage-increase flag to the given parser.az      If you enable this setting, Cloud SQL checks your available storage every
    30 seconds. If the available storage falls below a threshold size, Cloud
    SQL automatically adds additional storage capacity. If the available
    storage repeatedly falls below the threshold size, Cloud SQL continues to
    add storage until it reaches the maximum of 64 TB. Default: ON.
    z--auto-storage-increaserT   auto_storage_increaseTrV   Nr2   r7   s     r   AddAutoStorageIncreaseFlagrl      s-    ) 	"  r   c                 R    SnU R                  S[        R                  " 5       SUS9  g)z1Adds a --database-flags flag to the given parser.a      Comma-separated list of database flags to set on the instance. Use an equals
    sign to separate the flag name and value. Flags without values, like
    skip_grant_tables, can be written out without a value, e.g.,
    `skip_grant_tables=`. Use on/off values for booleans. View the Instance
    Resource API for allowed flags. (e.g., `--database-flags max_allowed_packet=55555
    skip_grant_tables=,log_output=1`).
  z--database-flagsz
FLAG=VALUE)r:   r9   r0   Nr;   r7   s     r   AddDatabaseFlagsFlagrn      s3    ) 	 	  r   c                 0    SnSS/nU R                  SXS9  g)z1Adds a --data-disk-type flag to the given parser.zType of storage.PD_SSDPD_HDDz--data-disk-typerP   Nr2   rQ   s      r   AddDataDiskTypeFlagrr      s%     )x '(yJr   c                 2    SnU R                  S[        US9  g)z1Adds a --data-disk-size flag to the given parser.ze    Storage capacity available to the database, in GB. The minimum (and
    default) size is 10GB.
  z--data-disk-sizerI   NrJ   r7   s     r   AddDataDiskSizeFlagrt     s!    ) 	(sCr   c                 0    SnSS/nU R                  SXS9  g)z4Adds a --availability-type flag to the given parser.zCloud SQL availability type.REGIONALZONALz--availability-typerP   Nr2   rQ   s      r   AddAvailabilityTypeFlagrx     s%    ,)!'+)Mr   c                 (    SnU R                  SUS9  g)z'Adds a --zone flag to the given parser.zX    Google Cloud Platform zone where your Cloud SQL database instance is
    located.
  z--zoner[   Nr2   r7   s     r   AddZoneFlagrz     s    ) 	hY/r   c                 (    SnU R                  SUS9  g)z1Adds a --secondary-zone flag to the given parser.z    Google Cloud Platform zone where the failover Cloud SQL database
    instance is located. Used when the Cloud SQL database availability type
    is REGIONAL (i.e. multiple zones / highly available).
  z--secondary-zoner[   Nr2   r7   s     r   AddSecondaryZoneFlagr|     s    )
 	(y9r   c                 (    SnU R                  SUS9  g)z5Adds a --allocated-ip-range flag to the given parser.z    The name of the allocated IP range for the private IP Cloud SQL instance.
    This name refers to an already allocated IP range.
    If set, the instance IP will be created in the allocated range.
  z--allocated-ip-ranger[   Nr2   r7   s     r   AddAllocatedIpRangeFlagr~   &  s    )
 	,9=r   c                 &    U R                  SSSS9  g)z*Add the root password field to the parser.z--root-passwordFzRoot Cloud SQL user's password.)r   r0   Nr2   r   s    r   AddRootPasswordr   0  s    ,  .r   c           	      ,    U R                  SSSSSSS9  g)	z4Adds a --enable-data-cache flag to the given parser.z--enable-data-cacheTFrT   enable_data_cachez}Enable use of data cache for accelerated read performance. This flag is only available for Enterprise Plus edition instances.)hiddenr   rW   rX   r0   Nr2   r   s    r   AddEnableDataCacheFlagr   8  s*    F  
r   N)"__doc__
__future__r   r   r   googlecloudsdk.callioper   r   _IP_ADDRESS_PART_CIDR_PREFIX_PARTformatrf   r   r   r   r=   r?   rG   rL   rR   rY   r\   r_   ri   rl   rn   rr   rt   rx   rz   r|   r~   r   r    r   r   <module>r      s    O &  ' / ( 9 0 CJJ,= K ?7/dQ?#(ON ;$""KDN0:>.r   