def AddAlphaArgs(parser): """Adds alpha args and flags to the parser.""" flags.AddActiveDirectoryDomain(parser)
def AddBaseArgs(parser, is_alpha=False): """Adds base args and flags to the parser.""" # TODO(b/35705305): move common flags to command_lib.sql.flags flags.AddActivationPolicy(parser) flags.AddActiveDirectoryDomain(parser) flags.AddAssignIp(parser) base.ASYNC_FLAG.AddToParser(parser) gae_apps_group = parser.add_mutually_exclusive_group() flags.AddAuthorizedGAEApps(gae_apps_group, update=True) gae_apps_group.add_argument( '--clear-gae-apps', required=False, action='store_true', help=('Specified to clear the list of App Engine apps that can access ' 'this instance.')) networks_group = parser.add_mutually_exclusive_group() flags.AddAuthorizedNetworks(networks_group, update=True) networks_group.add_argument( '--clear-authorized-networks', required=False, action='store_true', help=( 'Clear the list of external networks that are allowed to connect ' 'to the instance.')) flags.AddAvailabilityType(parser) backups_group = parser.add_mutually_exclusive_group() backups_enabled_group = backups_group.add_group() flags.AddBackupStartTime(backups_enabled_group) flags.AddBackupLocation(backups_enabled_group, allow_empty=True) flags.AddRetainedBackupsCount(backups_enabled_group) flags.AddRetainedTransactionLogDays(backups_enabled_group) backups_group.add_argument( '--no-backup', required=False, action='store_true', help='Specified if daily backup should be disabled.') database_flags_group = parser.add_mutually_exclusive_group() flags.AddDatabaseFlags(database_flags_group) database_flags_group.add_argument( '--clear-database-flags', required=False, action='store_true', help=('Clear the database flags set on the instance. ' 'WARNING: Instance will be restarted.')) flags.AddCPU(parser) parser.add_argument('--diff', action='store_true', help='Show what changed as a result of the update.') flags.AddEnableBinLog(parser, show_negated_in_help=True) parser.add_argument( '--enable-database-replication', action=arg_parsers.StoreTrueFalseAction, help=('Enable database replication. Applicable only for read replica ' 'instance(s). WARNING: Instance will be restarted.')) parser.add_argument( '--follow-gae-app', required=False, help=('First Generation instances only. The App Engine app ' 'this instance should follow. It must be in the same region as ' 'the instance. WARNING: Instance may be restarted.')) parser.add_argument('instance', completer=flags.InstanceCompleter, help='Cloud SQL instance ID.') flags.AddMaintenanceReleaseChannel(parser) parser.add_argument('--maintenance-window-any', action='store_true', help='Removes the user-specified maintenance window.') flags.AddMaintenanceWindowDay(parser) flags.AddMaintenanceWindowHour(parser) flags.AddDenyMaintenancePeriodStartDate(parser) flags.AddDenyMaintenancePeriodEndDate(parser) flags.AddDenyMaintenancePeriodTime(parser) parser.add_argument( '--remove-deny-maintenance-period', action='store_true', help='Removes the user-specified deny maintenance period.') flags.AddInsightsConfigQueryInsightsEnabled(parser, show_negated_in_help=True) flags.AddInsightsConfigQueryStringLength(parser) flags.AddInsightsConfigRecordApplicationTags(parser, show_negated_in_help=True) flags.AddInsightsConfigRecordClientAddress(parser, show_negated_in_help=True) flags.AddInsightsConfigQueryPlansPerMinute(parser) flags.AddMemory(parser) flags.AddPasswordPolicyMinLength(parser) flags.AddPasswordPolicyComplexity(parser) flags.AddPasswordPolicyReuseInterval(parser) flags.AddPasswordPolicyDisallowUsernameSubstring(parser) flags.AddPasswordPolicyPasswordChangeInterval(parser) flags.AddPasswordPolicyEnablePasswordPolicy(parser) flags.AddPasswordPolicyClearPasswordPolicy(parser) parser.add_argument( '--pricing-plan', '-p', required=False, choices=['PER_USE', 'PACKAGE'], help=('First Generation instances only. The pricing plan for this ' 'instance.')) flags.AddReplication(parser) parser.add_argument( '--require-ssl', action=arg_parsers.StoreTrueFalseAction, help=('mysqld should default to \'REQUIRE X509\' for users connecting ' 'over IP.')) flags.AddStorageAutoIncrease(parser) flags.AddStorageSize(parser) flags.AddTier(parser, is_patch=True, is_alpha=is_alpha) flags.AddEnablePointInTimeRecovery(parser) flags.AddNetwork(parser) flags.AddMaintenanceVersion(parser)
def AddBaseArgs(parser, is_alpha=False): """Declare flag and positional arguments for this command parser.""" # TODO(b/35705305): move common flags to command_lib.sql.flags base.ASYNC_FLAG.AddToParser(parser) parser.display_info.AddFormat(flags.GetInstanceListFormat()) flags.AddActivationPolicy(parser) flags.AddActiveDirectoryDomain(parser) flags.AddAssignIp(parser) flags.AddAuthorizedNetworks(parser) flags.AddAvailabilityType(parser) parser.add_argument( '--backup', required=False, action='store_true', default=True, help='Enables daily backup.') flags.AddBackupStartTime(parser) flags.AddBackupLocation(parser, allow_empty=False) flags.AddCPU(parser) flags.AddInstanceCollation(parser) flags.AddDatabaseFlags(parser) flags.AddEnableBinLog(parser, show_negated_in_help=False) flags.AddRetainedBackupsCount(parser) flags.AddRetainedTransactionLogDays(parser) parser.add_argument( '--failover-replica-name', required=False, help='Also create a failover replica with the specified name.') parser.add_argument( 'instance', type=command_validate.InstanceNameRegexpValidator(), help='Cloud SQL instance ID.') flags.AddMaintenanceReleaseChannel(parser) flags.AddMaintenanceWindowDay(parser) flags.AddMaintenanceWindowHour(parser) flags.AddDenyMaintenancePeriodStartDate(parser) flags.AddDenyMaintenancePeriodEndDate(parser) flags.AddDenyMaintenancePeriodTime(parser) flags.AddInsightsConfigQueryInsightsEnabled(parser, show_negated_in_help=True) flags.AddInsightsConfigQueryStringLength(parser) flags.AddInsightsConfigRecordApplicationTags( parser, show_negated_in_help=True) flags.AddInsightsConfigRecordClientAddress(parser, show_negated_in_help=True) flags.AddInsightsConfigQueryPlansPerMinute(parser) parser.add_argument( '--master-instance-name', required=False, help=('Name of the instance which will act as master in the ' 'replication setup. The newly created instance will be a read ' 'replica of the specified master instance.')) flags.AddMemory(parser) flags.AddPasswordPolicyMinLength(parser) flags.AddPasswordPolicyComplexity(parser) flags.AddPasswordPolicyReuseInterval(parser) flags.AddPasswordPolicyDisallowUsernameSubstring(parser) flags.AddPasswordPolicyPasswordChangeInterval(parser) flags.AddPasswordPolicyEnablePasswordPolicy(parser) parser.add_argument( '--replica-type', choices=['READ', 'FAILOVER'], help='The type of replica to create.') flags.AddReplication(parser) parser.add_argument( '--require-ssl', required=False, action='store_true', default=None, help='Specified if users connecting over IP must use SSL.') flags.AddRootPassword(parser) flags.AddStorageAutoIncrease(parser) flags.AddStorageSize(parser) parser.add_argument( '--storage-type', required=False, choices=['SSD', 'HDD'], default=None, help='The storage type for the instance. The default is SSD.') flags.AddTier(parser, is_alpha=is_alpha) kms_flag_overrides = { 'kms-key': '--disk-encryption-key', 'kms-keyring': '--disk-encryption-key-keyring', 'kms-location': '--disk-encryption-key-location', 'kms-project': '--disk-encryption-key-project' } kms_resource_args.AddKmsKeyResourceArg( parser, 'instance', flag_overrides=kms_flag_overrides) flags.AddEnablePointInTimeRecovery(parser) flags.AddNetwork(parser)
def AddAlphaArgs(parser): """Declare alpha flags for this command parser.""" flags.AddActiveDirectoryDomain(parser)