feat: Add new gcloud commands, API clients, and third-party libraries across various services.

This commit is contained in:
2026-01-01 20:26:35 +01:00
parent 5e23cbece0
commit a19e592eb7
25221 changed files with 8324611 additions and 0 deletions

View File

@@ -0,0 +1,37 @@
# -*- coding: utf-8 -*- #
# Copyright 2018 Google LLC. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Manage Cloud Memorystore Redis resources."""
from __future__ import absolute_import
from __future__ import division
from __future__ import unicode_literals
from googlecloudsdk.calliope import base
@base.ReleaseTracks(
base.ReleaseTrack.ALPHA,
base.ReleaseTrack.BETA,
base.ReleaseTrack.GA,
)
class Redis(base.Group):
"""Manage Cloud Memorystore Redis resources."""
category = base.DATABASES_CATEGORY
def Filter(self, context, args):
# TODO(b/190538727): Determine if command group works with project number
base.RequireProjectID(args)
del context, args

View File

@@ -0,0 +1,25 @@
# -*- coding: utf-8 -*- #
# Copyright 2022 Google LLC. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Command group for Cloud Memorystore Cluster for Redis."""
from __future__ import absolute_import
from __future__ import division
from __future__ import unicode_literals
from googlecloudsdk.calliope import base
class Clusters(base.Group):
"""Manage Memorystore for Redis Cluster instances."""

View File

@@ -0,0 +1,64 @@
- release_tracks: [ALPHA, BETA, GA]
help_text:
brief: |
Add more cluster endpoints.
description: |
This is required to enable multi-vpc for Redis cluster.
To add one cluster endpoint to an existing Redis cluster, two PSC connections MUST be added as a pair: one for the Redis cluster's discovery service attachment and the other for the additional service attachment.
Multiple cluster endpoints COULD be added simultaneously.
This command can fail for the following reasons:
* The cluster specified does not exist.
* The number of connections provided to a cluster endpoint are not in pairs.
* One of the connections is not found.
examples: |
To connect redis cluster to one additional VPC, run:
$ {command} my-redis-cluster add-cluster-endpoints --cluster-endpoint='["psc-connection":[{"psc-connection-id":"$ID","address":"$IP","network":"projects/$PROJECT/global/networks/$NETWORK","forwarding-rule":"projects/$PROJECT/regions/us-east1/forwardingRules/$FR_NAME","service-attachment":"projects/$PROJECT/regions/$REGION/serviceAttachments/$SA_NAME"},{$ADDITIONAL_PSC_CONNECTION}]]' --cluster_endpoint=$ADDITIONAL_CLUSTER_ENDPOINT
$PSCConnectionID SHOULD be extracted from forwarding rules. E.g. 75311697652483351
arguments:
resource:
spec: !REF googlecloudsdk.command_lib.redis.resources:cluster
help_text: |
Arguments and flags that specify the Memorystore Redis cluster you want to update.
params:
- arg_name: cluster-endpoint
api_field: cluster.clusterEndpoints
repeated: true
required: true
help_text: |
Resource details of a redis cluster endpoint
type: arg_object
spec:
- api_field: connections
json_name: psc-connection
type: arg_object
spec:
- api_field: pscConnection.pscConnectionId
json_name: psc-connection-id
- api_field: pscConnection.network
json_name: network
- api_field: pscConnection.address
json_name: address
- api_field: pscConnection.forwardingRule
json_name: forwarding-rule
- api_field: pscConnection.serviceAttachment
json_name: service-attachment
async:
collection: redis.projects.locations.operations
request:
ALPHA:
api_version: v1alpha1
BETA:
api_version: v1beta1
GA:
api_version: v1
modify_request_hooks:
- googlecloudsdk.command_lib.redis.psc_update_util:UpdateClusterEndpoints
collection: redis.projects.locations.clusters
method: patch

View File

@@ -0,0 +1,29 @@
# -*- coding: utf-8 -*- #
# Copyright 2024 Google LLC. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Command group for backup collections of Cloud Memorystore Cluster for Redis."""
from __future__ import absolute_import
from __future__ import division
from __future__ import unicode_literals
from googlecloudsdk.calliope import base
@base.ReleaseTracks(base.ReleaseTrack.ALPHA,
base.ReleaseTrack.BETA,
base.ReleaseTrack.GA)
@base.DefaultUniverseOnly
class BackupCollections(base.Group):
"""Manage backup collections of Memorystore for Redis Cluster instances."""

View File

@@ -0,0 +1,35 @@
- release_tracks: [ALPHA, BETA, GA]
help_text:
brief: |
Show metadata for a backup collection.
description: |
Show metadata for a backup collection.
Displays all metadata associated with a backup collection.
This command can fail for the following reasons:
* The backup collection specified does not exist.
* The active account does not have permission to access the given
backup collection.
examples: |
To display the metadata for a backup collection with the name `my-backup-collection`
in the us-central1 region, run:
$ {commmand} my-backup-collection --region=us-central1
arguments:
resource:
spec: !REF googlecloudsdk.command_lib.redis.resources:backup_collection
help_text: |
Arguments and flags that specify the backup collection you want to describe.
is_positional: true
request:
ALPHA:
api_version: v1alpha1
BETA:
api_version: v1beta1
GA:
api_version: v1
collection: redis.projects.locations.backupCollections

View File

@@ -0,0 +1,40 @@
- release_tracks: [ALPHA, BETA, GA]
help_text:
brief: |
List backup collections in a region.
description: |
List all backup collections under the specified project and region.
To specify the maximum number of results, use the `--limit` flag.
examples: |
To list up to 5 backup collections in the us-central1 region, run:
$ {command} --region=us-central1 --limit=5
arguments:
resource:
spec: !REF googlecloudsdk.command_lib.redis.resources:region
help_text: |
The region of the backup collections to display.
request:
ALPHA:
api_version: v1alpha1
BETA:
api_version: v1beta1
GA:
api_version: v1
collection: redis.projects.locations.backupCollections
response:
id_field: name
output:
format: |
table(
name.basename():label=BACKUP_COLLECTION_NAME:sort=2,
cluster:label=CLUSTER_NAME,
clusterUid:label=CLUSTER_UID
)

View File

@@ -0,0 +1,29 @@
# -*- coding: utf-8 -*- #
# Copyright 2024 Google LLC. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Command group for backups of Cloud Memorystore Cluster for Redis."""
from __future__ import absolute_import
from __future__ import division
from __future__ import unicode_literals
from googlecloudsdk.calliope import base
@base.ReleaseTracks(base.ReleaseTrack.ALPHA,
base.ReleaseTrack.BETA,
base.ReleaseTrack.GA)
@base.DefaultUniverseOnly
class Backups(base.Group):
"""Manage backups of Memorystore for Redis Cluster instances."""

View File

@@ -0,0 +1,40 @@
- release_tracks: [ALPHA, BETA, GA]
help_text:
brief: |
Delete a Memorystore for Redis Cluster backup.
description: |
Delete a Memorystore for Redis Cluster backup.
This command can fail for the following reasons:
* The backup specified does not exist.
* The active account does not have permission to access the given
backup.
examples: |
To delete a backup with the name `my-backup` under backup collection `my-backup-collection`
in `us-central1` region, run:
$ {command} my-backup --backup-collection=my-backup-collection --region=us-central1
arguments:
resource:
spec: !REF googlecloudsdk.command_lib.redis.resources:backup
help_text:
Arguments and flags that specify the Redis backup you want to delete.
async:
collection: redis.projects.locations.operations
input:
confirmation_prompt: |
You are about to delete backup [{__name__}] in [{locationsId}].
Any associated data will be lost.
request:
ALPHA:
api_version: v1alpha1
BETA:
api_version: v1beta1
GA:
api_version: v1
collection: redis.projects.locations.backupCollections.backups

View File

@@ -0,0 +1,34 @@
- release_tracks: [ALPHA, BETA, GA]
help_text:
brief: |
Show metadata for a Memorystore for Redis Cluster backup.
description: |
Show metadata for a Memorystore for Redis Cluster backup.
Displays all metadata associated with a backup given a valid backup name.
This command can fail for the following reasons:
* The backup specified does not exist.
* The active account does not have permission to access the given
backup.
examples: |
To display the metadata for a backup named `my-backup`, under `my-collection`
backup collection, in `us-central1` region, run:
$ {command} my-backup --backup_collection=my-collection --region=us-central1
arguments:
resource:
spec: !REF googlecloudsdk.command_lib.redis.resources:backup
help_text: |
Arguments and flags that specify the backup you want to describe.
request:
ALPHA:
api_version: v1alpha1
BETA:
api_version: v1beta1
GA:
api_version: v1
collection: redis.projects.locations.backupCollections.backups

View File

@@ -0,0 +1,40 @@
- release_tracks: [ALPHA, BETA, GA]
command_type: GENERIC
help_text:
brief: |
Export a Redis cluster backup to a Google Cloud Storage bucket.
description: |
This command exports a Redis cluster backup to a Google Cloud Storage bucket.
A new folder will be created in the bucket with the backup name. And the backup files will be
stored in the folder.
examples: |
To export a backup with name `my-backup` under backup collection `my-collection`
in `us-central` region to `my-bucket` Google Cloud Storage bucket, run:
$ {command} my-backup --backup-collection=my-collection --region=us-central1 --bucket-name=my-bucket
arguments:
resource:
spec: !REF googlecloudsdk.command_lib.redis.resources:backup
help_text:
Arguments and flags that specify the Redis backup you want to export.
params:
- arg_name: gcs-bucket
api_field: exportBackupRequest.gcsBucket
required: true
help_text: |
The name of the Google Cloud Storage bucket to export the backup to.
async:
collection: redis.projects.locations.operations
request:
ALPHA:
api_version: v1alpha1
BETA:
api_version: v1beta1
GA:
api_version: v1
collection: redis.projects.locations.backupCollections.backups
method: export

View File

@@ -0,0 +1,40 @@
- release_tracks: [ALPHA, BETA, GA]
help_text:
brief: |
List backups under a backup collection in a region.
description: |
List backups under a backup collection in a region.
To specify the maximum number of results, use the `--limit` flag.
examples: |
To list up to 5 backups in the us-central1 region, run:
$ {command} --backup-collection=my-collection --region=us-central1 --limit=5
arguments:
resource:
spec: !REF googlecloudsdk.command_lib.redis.resources:backup_collection
help_text: |
The backup collection of the backups to display.
request:
ALPHA:
api_version: v1alpha1
BETA:
api_version: v1beta1
GA:
api_version: v1
collection: redis.projects.locations.backupCollections.backups
response:
id_field: name
output:
format: |
table(
name.basename():label=BACKUP_NAME,
state:label=STATE,
createTime:label=CREATE_TIME:sort=1,
expireTime:label=EXPIRE_TIME:sort=2
)

View File

@@ -0,0 +1,285 @@
- release_tracks: [ALPHA, BETA, GA]
help_text:
brief: |
Create a new Memorystore for Redis Cluster instance.
description: |
Create a new Memorystore for Redis Cluster instance, and uses Private Service Connect service connectivity automation to automate connectivity for instances.
This command can fail for the following reasons:
* A cluster with the same name already exists.
* The active account does not have permission to create clusters.
* Some required APIs not enabled yet.
* No connection policy defined yet on the network and in the region a cluster will be created.
* Miss the steps for creating and configuring a service account (to grant permissions) in both host project and service project, if a shared VPC network is used.
Refer to https://cloud.google.com/memorystore/docs/cluster/networking#prerequisites_required_before_creating_a_cluster for prerequisites.
examples: |
To create a cluster with name `my-redis-cluster` in region `us-central1`
with 3 shards and with a discovery endpoint created on network "default", run:
$ {command} my-redis-cluster --region=us-central1 --shard-count=3 \
--network=projects/NETWORK_PROJECT_ID/global/networks/default
arguments:
resource:
spec: !REF googlecloudsdk.command_lib.redis.resources:cluster
help_text: |
Arguments and flags that specify the cluster you want to create.
Your cluster ID must be 1 to 63 characters and use only lowercase letters, numbers, or
hyphens. It must start with a lowercase letter and end with a lowercase letter or number.
params:
- arg_name: node-type
api_field: cluster.nodeType
help_text: Node Type of the redis cluster Node.
choices:
- enum_value: REDIS_HIGHMEM_MEDIUM
arg_value: redis-highmem-medium
- enum_value: REDIS_HIGHMEM_XLARGE
arg_value: redis-highmem-xlarge
- enum_value: REDIS_STANDARD_SMALL
arg_value: redis-standard-small
- enum_value: REDIS_SHARED_CORE_NANO
arg_value: redis-shared-core-nano
- arg_name: network
api_field: cluster.pscConfigs.network
help_text: |
The network used to create your instance. It must use the format:
projects/NETWORK_PROJECT_ID/global/networks/NETWORK_ID.
The network ID used here must match the network ID used by the service connection policy.
Otherwise, the create operation fails
- arg_name: auth-mode
api_field: cluster.authorizationMode
help_text: |
Available authorization mode of a Redis cluster.
choices:
- enum_value: AUTH_MODE_DISABLED
arg_value: disabled
help_text: |
Authorization is disabled for the cluster.
- enum_value: AUTH_MODE_IAM_AUTH
arg_value: iam-auth
help_text: |
IAM basic authorization is enabled for the cluster.
- arg_name: replica-count
api_field: cluster.replicaCount
type: int
help_text: |
The replica count of each shard.
- arg_name: shard-count
api_field: cluster.shardCount
type: int
help_text: |
The shard count of the cluster.
- arg_name: transit-encryption-mode
api_field: cluster.transitEncryptionMode
help_text: |
Transit encryption mode used for the Redis cluster.
If not provided, encryption is disabled for the cluster.
choices:
- enum_value: TRANSIT_ENCRYPTION_MODE_DISABLED
arg_value: disabled
help_text: |
In-transit encryption is disabled for the cluster.
- enum_value: TRANSIT_ENCRYPTION_MODE_SERVER_AUTHENTICATION
arg_value: server-authentication
help_text: |
The cluster uses server managed encryption for in-transit encryption.
- arg_name: deletion-protection
api_field: cluster.deletionProtectionEnabled
type: bool
# To distinguish b/w unset and default value. Otherwise, the request is always sent with
# deletionProtectionEnabled=false.
default: null
help_text: |
Enable deletion protection for the Redis Cluster. Use
`--deletion-protection`/`--no-deletion-protection` to enable/disable it.
- arg_name: redis-config
api_field: cluster.redisConfigs.additionalProperties
metavar: KEY=VALUE
help_text: |
A list of Redis config KEY=VALUE pairs to set on the Redis Cluster according to
http://redis.io/topics/config. Currently the supported Redis configs are:
maxmemory-clients, maxmemory, maxmemory-policy, notify-keyspace-events,
slowlog-log-slower-than, maxclients.
type:
arg_dict:
flatten: true
spec:
- api_field: key
- api_field: value
- arg_name: zone-distribution-mode
api_field: cluster.zoneDistributionConfig.mode
help_text: |
Determines how the cluster nodes are distributed across zones.
choices:
- enum_value: MULTI_ZONE
arg_value: multi-zone
help_text: |
Allocate cluster nodes across multiple zones.
- enum_value: SINGLE_ZONE
arg_value: single-zone
help_text: |
Allocate cluster nodes in a single zone.
- arg_name: zone
api_field: cluster.zoneDistributionConfig.zone
help_text: |
The zone used to allocate the cluster nodes. Applicable only if the zone-distribution-mode
is set to single-zone.
- arg_name: persistence-mode
api_field: cluster.persistenceConfig.mode
help_text: |
Operation mode for persistence.
choices:
- enum_value: DISABLED
arg_value: disabled
help_text: Persistence mode is disabled
- enum_value: RDB
arg_value: RDB
help_text: RDB-based persistence
- enum_value: AOF
arg_value: AOF
help_text: AOF-based persistence
- arg_name: rdb-snapshot-period
api_field: cluster.persistenceConfig.rdbConfig.rdbSnapshotPeriod
help_text: |
Attempted period between RDB snapshots.
choices:
- enum_value: ONE_HOUR
arg_value: 1h
help_text: 1 hour
- enum_value: SIX_HOURS
arg_value: 6h
help_text: 6 hours
- enum_value: TWELVE_HOURS
arg_value: 12h
help_text: 12 hours
- enum_value: TWENTY_FOUR_HOURS
arg_value: 24h
help_text: (default) 24 hours
- arg_name: rdb-snapshot-start-time
api_field: cluster.persistenceConfig.rdbConfig.rdbSnapshotStartTime
help_text: |
Date and time of the first snapshot in the ISO 1801 format, and alignment time for future snapshots. For example, 2024-01-01T01:00:00Z.
If not specified, the current time will be used.
- arg_name: aof-append-fsync
api_field: cluster.persistenceConfig.aofConfig.appendFsync
help_text: |
Fsync configuration.
choices:
- enum_value: NO # yamllint disable-line rule:truthy
arg_value: no # yamllint disable-line rule:truthy
help_text: |
Redis will not explicitly call fsync.
- enum_value: EVERYSEC
arg_value: everysec
help_text: |
(default) Redis explicitly calls fsync every second.
- enum_value: ALWAYS
arg_value: always
help_text: |
Redis explicitly calls fsync for every write command.
- arg_name: maintenance-window-day
api_field: cluster.maintenancePolicy.weeklyMaintenanceWindow.day
choices:
- arg_value: monday
enum_value: MONDAY
- arg_value: tuesday
enum_value: TUESDAY
- arg_value: wednesday
enum_value: WEDNESDAY
- arg_value: thursday
enum_value: THURSDAY
- arg_value: friday
enum_value: FRIDAY
- arg_value: saturday
enum_value: SATURDAY
- arg_value: sunday
enum_value: SUNDAY
help_text: |
Day of week when the window starts, e.g. `sunday`.
- arg_name: maintenance-window-hour
api_field: cluster.maintenancePolicy.weeklyMaintenanceWindow.startTime.hours
help_text: |
Hour of day (`0` to `23`) for the start of maintenance window, in UTC time zone.
processor: googlecloudsdk.command_lib.redis.clusters_update_util:CheckMaintenanceWindowStartTimeField
- arg_name: cross-cluster-replication-role
api_field: cluster.crossClusterReplicationConfig.clusterRole
help_text: |
The role of the cluster in cross cluster replication.
choices:
- enum_value: SECONDARY
arg_value: secondary
help_text: |
Create a secondary cluster.
- arg_name: primary-cluster
api_field: cluster.crossClusterReplicationConfig.primaryCluster.cluster
help_text: |
The primary cluster that the secondary cluster will replicate from. It must use the format:
projects/PROJECT_ID/locations/REGION/clusters/CLUSTER_ID. It must refer to an existing cluster. Otherwise, the create operation fails.
- arg_name: automated-backup-mode
api_field: cluster.automatedBackupConfig.automatedBackupMode
help_text: |
Automated backup mode
choices:
- enum_value: DISABLED
arg_value: disabled
help_text: |
(default) Automated backup is disabled.
- enum_value: ENABLED
arg_value: enabled
help_text: |
Automated backup is enabled.
- arg_name: automated-backup-start-time
api_field: cluster.automatedBackupConfig.fixedFrequencySchedule.startTime
help_text: |
One-hour window when you want automated-backup operations to start. Specify the time in the format HH:00 on a 24-hour cycle in UTC time.
ALPHA:
processor: googlecloudsdk.command_lib.redis.cluster_util:ParseTimeOfDayAlpha
BETA:
processor: googlecloudsdk.command_lib.redis.cluster_util:ParseTimeOfDayBeta
GA:
processor: googlecloudsdk.command_lib.redis.cluster_util:ParseTimeOfDayGa
- arg_name: automated-backup-ttl
api_field: cluster.automatedBackupConfig.retention
type: googlecloudsdk.core.util.times:ParseDuration
processor: googlecloudsdk.core.util.times:FormatDurationForJson
help_text: |
Time to live for automated backups. A backup will be deleted automatically after the TTL
is reached. It ranges from 1 day to 365 days. For example, "10d" for 10 days. If not specified, the default value is 35 days.
- group:
mutex: true
params:
- arg_name: import-gcs-object-uris
type: 'googlecloudsdk.calliope.arg_parsers:ArgList:'
api_field: cluster.gcsSource.uris
help_text: |
URIs of Google Cloud Storage objects to import from. For example, `gs://bucket/folder/file1.rdb,gs://bucket/folder/file2.rdb`.
- arg_name: import-managed-backup
api_field: cluster.managedBackupSource.backup
help_text: |
Managed backup to import from. For example, `projects/PROJECT_ID/locations/REGION/backupCollections/BACKUP_COLLECTION_ID/backups/BACKUP_ID`.
- arg_name: kms-key
api_field: cluster.kmsKey
help_text: |
The resource name of the customer-managed encryption key (CMEK) to use for the cluster.
It must use this format:
projects/PROJECT_ID/locations/LOCATION/keyRings/KEY_RING/cryptoKeys/CRYPTO_KEY.
The key must be in the same region as the cluster. Otherwise, the create operation fails.
async:
collection: redis.projects.locations.operations
request:
ALPHA:
api_version: v1alpha1
BETA:
api_version: v1beta1
GA:
api_version: v1
collection: redis.projects.locations.clusters
output:
format: yaml

View File

@@ -0,0 +1,47 @@
- release_tracks: [ALPHA, BETA, GA]
help_text:
brief: |
Create a backup of a Redis cluster.
description: |
Create a backup of a Redis cluster. The backup can be used to seed a new cluster or
exported to a Google Cloud Storage bucket.
The created backup will be added into the backup collection associated with the cluster.
Describe the cluster to get the backup collection name.
example: |
To create a new backup, run:
$ {command} my-cluster --backup-id=my-backup --ttl=7d --region=us-central1
arguments:
resource:
spec: !REF googlecloudsdk.command_lib.redis.resources:cluster
help_text: |
Arguments and flags that specify the Memorystore Redis cluster to create a backup for.
params:
- arg_name: backup-id
api_field: backupClusterRequest.backupId
help_text: |
The ID of the backup.
- arg_name: ttl
api_field: backupClusterRequest.ttl
type: googlecloudsdk.core.util.times:ParseDuration
processor: googlecloudsdk.core.util.times:FormatDurationForJson
help_text: |
The time to live for the backup. The backup will be deleted automatically after the TTL
is reached. For example, "10d" for 10 days. The minimum value is 1 day. If not specified, the
default value is 100 years.
async:
collection: redis.projects.locations.operations
request:
ALPHA:
api_version: v1alpha1
BETA:
api_version: v1beta1
GA:
api_version: v1
collection: redis.projects.locations.clusters
method: backup

View File

@@ -0,0 +1,39 @@
- release_tracks: [ALPHA, BETA, GA]
help_text:
brief: |
Delete a Memorystore for Redis Cluster instance.
description: |
Delete a Memorystore for Redis Cluster instance.
This command can fail for the following reasons:
* The cluster specified does not exist.
* The active account does not have permission to access the given
cluster.
examples: |
To delete a cluster with the name `my-redis-cluster` in your default region, run:
$ {command} my-redis-cluster
arguments:
resource:
spec: !REF googlecloudsdk.command_lib.redis.resources:cluster
help_text: |
Arguments and flags that specify the cluster you want to delete.
async:
collection: redis.projects.locations.operations
input:
confirmation_prompt: |
You are about to delete cluster [{__name__}] in [{locationsId}].
Any associated data will be lost.
request:
ALPHA:
api_version: v1alpha1
BETA:
api_version: v1beta1
GA:
api_version: v1
collection: redis.projects.locations.clusters

View File

@@ -0,0 +1,35 @@
- release_tracks: [ALPHA, BETA, GA]
help_text:
brief: |
Show metadata for a Memorystore for Redis Cluster instance.
description: |
Show metadata for a Memorystore for Redis Cluster instance.
Displays all metadata associated with a cluster given a valid
cluster name.
This command can fail for the following reasons:
* The cluster specified does not exist.
* The active account does not have permission to access the given
cluster.
examples: |
To display the metadata for a cluster with the name `my-redis-cluster`
in the default region, run:
$ {command} my-redis-cluster
arguments:
resource:
spec: !REF googlecloudsdk.command_lib.redis.resources:cluster
help_text: |
Arguments and flags that specify the cluster you want to describe.
request:
ALPHA:
api_version: v1alpha1
BETA:
api_version: v1beta1
GA:
api_version: v1
collection: redis.projects.locations.clusters

View File

@@ -0,0 +1,38 @@
- release_tracks: [ALPHA, BETA, GA]
help_text:
brief: |
Detach a secondary cluster.
description: |
Detach a secondary cluster from the primary cluster.
After detachment, the secondary cluster becomes an independent cluster, i.e. it stops replicating
from the primary cluster and it now accepts both read and write requests.
This command is only supported on secondary clusters.
examples: |
To detach a secondary cluster with name `my-secondary-cluster` in region `us-central1`, run:
$ {command} my-secondary-cluster --region=us-central1
arguments:
resource:
spec: !REF googlecloudsdk.command_lib.redis.resources:cluster
help_text: |
Arguments and flags that specify the Memorystore Redis cluster you want to update.
async:
collection: redis.projects.locations.operations
request:
ALPHA:
api_version: v1alpha1
BETA:
api_version: v1beta1
GA:
api_version: v1
collection: redis.projects.locations.clusters
method: patch
modify_request_hooks:
- googlecloudsdk.command_lib.redis.clusters_ccr_util:Detach

View File

@@ -0,0 +1,45 @@
- release_tracks: [ALPHA, BETA, GA]
help_text:
brief: |
Detach one or more secondary clusters from the primary cluster.
description: |
Detach one or more secondary clusters from the primary cluster.
After detachment, the secondary clusters become independent clusters, i.e. they stop replicating
from the primary cluster and will now accept both read and write requests.
This command is only supported on primary clusters.
examples: |
To detach the secondary clusters `my-secondary-cluster1` and `my-secondary-cluster2` from the primary cluster `my-primary-cluster`, run:
$ {command} my-primary-cluster --region=us-central1 --clusters-to-detach=projects/my-project/locations/us-east1/clusters/my-secondary-cluster1,projects/my-project/locations/asia-east1/clusters/my-secondary-cluster2
arguments:
resource:
spec: !REF googlecloudsdk.command_lib.redis.resources:cluster
help_text: |
Arguments and flags that specify the Memorystore Redis cluster you want to update.
params:
- arg_name: clusters-to-detach
required: true
help_text: |
Comma separated list of secondary clusters to detach from the primary cluster.
Each element in the list should be in the format: `projects/PROJECT_ID/locations/REGION/clusters/CLUSTER_ID`.
async:
collection: redis.projects.locations.operations
request:
ALPHA:
api_version: v1alpha1
BETA:
api_version: v1beta1
GA:
api_version: v1
collection: redis.projects.locations.clusters
method: patch
modify_request_hooks:
- googlecloudsdk.command_lib.redis.clusters_ccr_util:DetachSecondaries

View File

@@ -0,0 +1,35 @@
- release_tracks: [ALPHA, BETA, GA]
help_text:
brief: |
Get the certificate authority information for a Memorystore for Redis Cluster instance.
description: |
Get the certificate authority information for a Memorystore for Redis Cluster instance.
This command can fail for the following reasons:
* The cluster specified does not exist.
* The active account does not have permission to access the given
cluster.
examples: |
To get the metadata for a cluster with the name `my-redis-cluster`
in the default region, run:
$ {command} my-redis-cluster
arguments:
resource:
spec: !REF googlecloudsdk.command_lib.redis.resources:cluster
help_text: |
Arguments and flags that specify the cluster.
request:
ALPHA:
api_version: v1alpha1
BETA:
api_version: v1beta1
GA:
api_version: v1
collection: redis.projects.locations.clusters
method: getCertificateAuthority
modify_request_hooks:
- googlecloudsdk.command_lib.redis.util:UpdateGetCertificateAuthorityRequestPath

View File

@@ -0,0 +1,46 @@
- release_tracks: [ALPHA, BETA, GA]
help_text:
brief: |
List Memorystore for Redis Cluster instances.
description: |
List all clusters under the specified project and region.
To specify the maximum number of clusters to list, use the --limit flag.
examples: |
To list up to five clusters, run:
$ {command} --limit=5
arguments:
resource:
spec: !REF googlecloudsdk.command_lib.redis.resources:region
help_text: |
The region of the clusters to display.
request:
ALPHA:
api_version: v1alpha1
BETA:
api_version: v1beta1
GA:
api_version: v1
collection: redis.projects.locations.clusters
response:
id_field: name
output:
format: |
table(
name.basename():label=CLUSTER_NAME:sort=2,
state:label=STATUS,
name.segment(3):label=REGION,
nodeType:label=NODE_TYPE,
preciseSizeGb:label=PRECISE_SIZE_GB,
sizeGb:label=SIZE_GB,
shardCount:label=SHARD_COUNT,
replicaCount:label=REPLICA_COUNT,
createTime.date()
)

View File

@@ -0,0 +1,53 @@
- release_tracks: [ALPHA, BETA, GA]
help_text:
brief: |
Remove existing Memorystore cluster endpoints.
description: |
To remove one cluster endpoint from an existing Redis cluster, two PSC connections MUST be removed as a pair: one to the Redis cluster's discovery service attachment and the other to its additional service attachment.
Multiple cluster endpoints COULD be removed simultaneously.
This command can fail for the following reasons:
* The cluster specified does not exist.
* Some connections in the to be removed list do not exist.
examples: |
To remove an endpoint from redis cluster, run:
$ {command} my-redis-cluster remove-cluster-endpoints --cluster-endpoint='["psc-connection":[{"psc-connection-id":"$PSC_CONNECTION_ID"},{$ADDITIONAL_PSC_CONNECTION}]]' --cluster_endpoint=$ADDITIONAL_CLUSTER_ENDPOINT
$PSCConnectionID SHOULD be extracted from forwarding rules. E.g. 75311697652483351
arguments:
resource:
spec: !REF googlecloudsdk.command_lib.redis.resources:cluster
help_text: |
Arguments and flags that specify the Memorystore Redis cluster you want to update.
params:
- arg_name: cluster-endpoint
api_field: cluster.clusterEndpoints
repeated: true
required: true
help_text: |
Resource details of a redis cluster endpoint
type: arg_object
spec:
- api_field: connections
json_name: psc-connection
type: arg_object
spec:
- api_field: pscConnection.pscConnectionId
json_name: psc-connection-id
async:
collection: redis.projects.locations.operations
request:
ALPHA:
api_version: v1alpha1
BETA:
api_version: v1beta1
GA:
api_version: v1
modify_request_hooks:
- googlecloudsdk.command_lib.redis.psc_update_util:RemoveClusterEndpoints
collection: redis.projects.locations.clusters
method: patch

View File

@@ -0,0 +1,49 @@
release_tracks: [ALPHA, BETA, GA]
help_text:
brief: |
Reschedule maintenance window for a Memorystore for
Redis Cluster instance.
description: |
Reschedule maintenance window for a Memorystore for
Redis Cluster instance.
examples: |
To reschedule maintenance window for an instance with the name 'my-redis-cluster' in region
'us-central-1' with immediate, run:
$ {command} my-redis-cluster --region=us-central1 --reschedule-type=IMMEDIATE
arguments:
resource:
spec: !REF googlecloudsdk.command_lib.redis.resources:cluster
help_text: |
Arguments and flags that specify the Cloud Memorystore for Redis cluster instance you
want to reschedule maintenance window.
params:
- arg_name: reschedule-type
api_field: rescheduleClusterMaintenanceRequest.rescheduleType
required: true
choices:
- arg_value: IMMEDIATE
enum_value: IMMEDIATE
help_text: Reschedule the maintenance to perform now.
- arg_value: SPECIFIC-TIME
enum_value: SPECIFIC_TIME
help_text: Reschedule the maintenance to a specific time.
help_text: |
Reschedule type to use for the reschedule maintenance window.
- arg_name: schedule-time
api_field: rescheduleClusterMaintenanceRequest.scheduleTime
help_text: |
Time in RFC3339 format, for example: 2012-11-15T16:19:00.094Z
async:
collection: redis.projects.locations.operations
request:
ALPHA:
api_version: v1alpha1
modify_request_hooks:
- googlecloudsdk.command_lib.redis.clusters_reschedule_util:CheckSpecificTimeField
collection: redis.projects.locations.clusters
method: rescheduleClusterMaintenance

View File

@@ -0,0 +1,39 @@
- release_tracks: [ALPHA, BETA, GA]
help_text:
brief: |
Switchover to a secondary cluster.
description: |
This command promotes the secondary cluster to become the new primary cluster. The old primary
and other secondary clusters will automatically become the secondary clusters of this cluster.
After the successful completion of this operation, the new primary cluster will accept both read
and write requests.
This command is only supported on secondary clusters.
examples: |
To switchover to a secondary cluster with name `my-secondary-cluster` in region `us-central1`, run:
$ {command} my-secondary-cluster --region=us-central1
arguments:
resource:
spec: !REF googlecloudsdk.command_lib.redis.resources:cluster
help_text: |
Arguments and flags that specify the Memorystore Redis cluster you want to update.
async:
collection: redis.projects.locations.operations
request:
ALPHA:
api_version: v1alpha1
BETA:
api_version: v1beta1
GA:
api_version: v1
collection: redis.projects.locations.clusters
method: patch
modify_request_hooks:
- googlecloudsdk.command_lib.redis.clusters_ccr_util:Switchover

View File

@@ -0,0 +1,232 @@
- release_tracks: [ALPHA, BETA, GA]
help_text:
brief: |
Update Memorystore Cluster for Redis instance.
description: |
Update the metadata and/or configuration parameters of a Redis cluster.
This command can fail for the following reasons:
* The cluster specified does not exist.
* The active account does not have permission to update the given
cluster.
examples: |
To update a Redis cluster with 5 shard and 2 replica, run:
$ {command} my-redis-cluster --shard-count=5 --replica-count=2
arguments:
resource:
spec: !REF googlecloudsdk.command_lib.redis.resources:cluster
help_text: |
Arguments and flags that specify the Memorystore Redis cluster you want to update.
params:
- arg_name: node-type
api_field: cluster.nodeType
help_text: Node Type of the redis cluster Node.
choices:
- enum_value: REDIS_HIGHMEM_MEDIUM
arg_value: redis-highmem-medium
- enum_value: REDIS_HIGHMEM_XLARGE
arg_value: redis-highmem-xlarge
- enum_value: REDIS_STANDARD_SMALL
arg_value: redis-standard-small
- enum_value: REDIS_SHARED_CORE_NANO
arg_value: redis-shared-core-nano
- arg_name: replica-count
api_field: cluster.replicaCount
type: int
help_text: |
The replica count of each shard.
- arg_name: maintenance-version
api_field: cluster.maintenanceVersion
help_text: |
The maintenance version of the cluster.
- arg_name: shard-count
api_field: cluster.shardCount
type: int
help_text: |
The shard count of the cluster.
- arg_name: deletion-protection
api_field: cluster.deletionProtectionEnabled
type: bool
help_text: |
Enable deletion protection for the Redis Cluster. Use
`--deletion-protection`/`--no-deletion-protection` to enable/disable it.
- arg_name: persistence-mode
api_field: cluster.persistenceConfig.mode
help_text: |
Operation mode for persistence.
choices:
- enum_value: DISABLED
arg_value: disabled
help_text: Persistence mode is disabled
- enum_value: RDB
arg_value: RDB
help_text: RDB-based persistence
- enum_value: AOF
arg_value: AOF
help_text: AOF-based persistence
- arg_name: rdb-snapshot-period
api_field: cluster.persistenceConfig.rdbConfig.rdbSnapshotPeriod
help_text: |
Attempted period between RDB snapshots.
choices:
- enum_value: ONE_HOUR
arg_value: 1h
help_text: 1 hour
- enum_value: SIX_HOURS
arg_value: 6h
help_text: 6 hours
- enum_value: TWELVE_HOURS
arg_value: 12h
help_text: 12 hours
- enum_value: TWENTY_FOUR_HOURS
arg_value: 24h
help_text: (default) 24 hours
- arg_name: rdb-snapshot-start-time
api_field: cluster.persistenceConfig.rdbConfig.rdbSnapshotStartTime
help_text: |
Date and time of the first snapshot in the ISO 1801 format, and alignment time for future snapshots. For example, 2024-01-01T01:00:00Z.
If not specified, the current time will be used.
- arg_name: aof-append-fsync
api_field: cluster.persistenceConfig.aofConfig.appendFsync
help_text: |
Fsync configuration.
choices:
- enum_value: NO # yamllint disable-line rule:truthy
arg_value: no # yamllint disable-line rule:truthy
help_text: |
Redis will not explicitly call fsync.
- enum_value: EVERYSEC
arg_value: everysec
help_text: |
(default) Redis explicitly calls fsync every second.
- enum_value: ALWAYS
arg_value: always
help_text: |
Redis explicitly calls fsync for every write command.
- arg_name: automated-backup-mode
api_field: cluster.automatedBackupConfig.automatedBackupMode
help_text: |
Automated backup mode
choices:
- enum_value: DISABLED
arg_value: disabled
help_text: |
(default) Automated backup is disabled.
- enum_value: ENABLED
arg_value: enabled
help_text: |
Automated backup is enabled.
- arg_name: automated-backup-start-time
api_field: cluster.automatedBackupConfig.fixedFrequencySchedule.startTime
help_text: |
One-hour window when you want automated-backup operations to start. Specify the time in the format HH:00 on a 24-hour cycle in UTC time.
ALPHA:
processor: googlecloudsdk.command_lib.redis.cluster_util:ParseTimeOfDayAlpha
BETA:
processor: googlecloudsdk.command_lib.redis.cluster_util:ParseTimeOfDayBeta
GA:
processor: googlecloudsdk.command_lib.redis.cluster_util:ParseTimeOfDayGa
- arg_name: automated-backup-ttl
api_field: cluster.automatedBackupConfig.retention
type: googlecloudsdk.core.util.times:ParseDuration
processor: googlecloudsdk.core.util.times:FormatDurationForJson
help_text: |
Time to live for automated backups. A backup will be deleted automatically after the TTL
is reached. It ranges from 1 day to 365 days. For example, "10d" for 10 days. If not specified, the default value is 35 days.
- group:
mutex: true
params:
- arg_name: maintenance-window-any
action: store_true
help_text: |
Removes the user-specified maintenance window.
- group:
params:
- arg_name: maintenance-window-day
api_field: cluster.maintenancePolicy.weeklyMaintenanceWindow.day
choices:
- arg_value: monday
enum_value: MONDAY
- arg_value: tuesday
enum_value: TUESDAY
- arg_value: wednesday
enum_value: WEDNESDAY
- arg_value: thursday
enum_value: THURSDAY
- arg_value: friday
enum_value: FRIDAY
- arg_value: saturday
enum_value: SATURDAY
- arg_value: sunday
enum_value: SUNDAY
help_text: |
The day of week when the window starts, e.g. `sunday`.
- arg_name: maintenance-window-hour
api_field: cluster.maintenancePolicy.weeklyMaintenanceWindow.startTime.hours
help_text: |
Hour of day (`0` to `23`) for the start of maintenance window, in UTC time zone.
processor: googlecloudsdk.command_lib.redis.clusters_update_util:CheckMaintenanceWindowStartTimeField
- arg_name: simulate-maintenance-event
action: store_true
help_text: |
Trigger a simulation for maintenance event.
type: bool
additional_arguments_hook: googlecloudsdk.command_lib.redis.cluster_util:AdditionalClusterUpdateArguments
async:
collection: redis.projects.locations.operations
request:
ALPHA:
api_version: v1alpha1
modify_request_hooks:
- googlecloudsdk.command_lib.redis.clusters_update_util:UpdateReplicaCount
- googlecloudsdk.command_lib.redis.clusters_update_util:UpdateShardCount
- googlecloudsdk.command_lib.redis.clusters_update_util:UpdateDeletionProtection
- googlecloudsdk.command_lib.redis.clusters_update_util:UpdatePersistenceConfig
- googlecloudsdk.command_lib.redis.clusters_update_util:RemoveRedisConfigs
- googlecloudsdk.command_lib.redis.clusters_update_util:UpdateRedisConfigs
- googlecloudsdk.command_lib.redis.clusters_update_util:UpdateMaintenanceWindowAny
- googlecloudsdk.command_lib.redis.clusters_update_util:UpdateMaintenanceWindowPolicy
- googlecloudsdk.command_lib.redis.clusters_update_util:UpdateSimulateMaintenanceEvent
- googlecloudsdk.command_lib.redis.clusters_update_util:UpdateAutomatedBackupConfig
- googlecloudsdk.command_lib.redis.clusters_update_util:UpdateNodeType
- googlecloudsdk.command_lib.redis.clusters_update_util:UpdateMaintenanceVersion
BETA:
api_version: v1beta1
modify_request_hooks:
- googlecloudsdk.command_lib.redis.clusters_update_util:UpdateReplicaCount
- googlecloudsdk.command_lib.redis.clusters_update_util:UpdateShardCount
- googlecloudsdk.command_lib.redis.clusters_update_util:UpdateDeletionProtection
- googlecloudsdk.command_lib.redis.clusters_update_util:UpdatePersistenceConfig
- googlecloudsdk.command_lib.redis.clusters_update_util:RemoveRedisConfigs
- googlecloudsdk.command_lib.redis.clusters_update_util:UpdateRedisConfigs
- googlecloudsdk.command_lib.redis.clusters_update_util:UpdateMaintenanceWindowAny
- googlecloudsdk.command_lib.redis.clusters_update_util:UpdateMaintenanceWindowPolicy
- googlecloudsdk.command_lib.redis.clusters_update_util:UpdateSimulateMaintenanceEvent
- googlecloudsdk.command_lib.redis.clusters_update_util:UpdateAutomatedBackupConfig
- googlecloudsdk.command_lib.redis.clusters_update_util:UpdateNodeType
- googlecloudsdk.command_lib.redis.clusters_update_util:UpdateMaintenanceVersion
GA:
api_version: v1
modify_request_hooks:
- googlecloudsdk.command_lib.redis.clusters_update_util:UpdateReplicaCount
- googlecloudsdk.command_lib.redis.clusters_update_util:UpdateShardCount
- googlecloudsdk.command_lib.redis.clusters_update_util:UpdateDeletionProtection
- googlecloudsdk.command_lib.redis.clusters_update_util:UpdatePersistenceConfig
- googlecloudsdk.command_lib.redis.clusters_update_util:RemoveRedisConfigs
- googlecloudsdk.command_lib.redis.clusters_update_util:UpdateRedisConfigs
- googlecloudsdk.command_lib.redis.clusters_update_util:UpdateMaintenanceWindowAny
- googlecloudsdk.command_lib.redis.clusters_update_util:UpdateMaintenanceWindowPolicy
- googlecloudsdk.command_lib.redis.clusters_update_util:UpdateSimulateMaintenanceEvent
- googlecloudsdk.command_lib.redis.clusters_update_util:UpdateAutomatedBackupConfig
- googlecloudsdk.command_lib.redis.clusters_update_util:UpdateNodeType
- googlecloudsdk.command_lib.redis.clusters_update_util:UpdateMaintenanceVersion
collection: redis.projects.locations.clusters
update:
read_modify_update: true
disable_auto_field_mask: true

View File

@@ -0,0 +1,49 @@
# -*- coding: utf-8 -*- #
# Copyright 2018 Google LLC. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Command group for Cloud Memorystore Redis instances."""
from __future__ import absolute_import
from __future__ import division
from __future__ import unicode_literals
from googlecloudsdk.calliope import base
class Instances(base.Group):
"""Manage Cloud Memorystore Redis instances.
## EXAMPLES
To create an instance with the name `my-redis-instance`, run:
$ {command} create my-redis-instance
To delete an instance with the name `my-redis-instance`, run:
$ {command} delete my-redis-instance
To display the details for an instance with the name `my-redis-instance`, run:
$ {command} describe my-redis-instance
To list all the instances, run:
$ {command} list
To set the label `env` to `prod` for an instance with the name
`my-redis-instance`, run:
$ {command} my-redis-instance --update-labels=env=prod
"""

View File

@@ -0,0 +1,26 @@
# -*- coding: utf-8 -*- #
# Copyright 2021 Google LLC. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Command group for managing Redis instance configurations."""
from __future__ import absolute_import
from __future__ import division
from __future__ import unicode_literals
from googlecloudsdk.calliope import base
@base.ReleaseTracks(base.ReleaseTrack.ALPHA)
class Config(base.Group):
"""Manage Redis instance configurations."""

View File

@@ -0,0 +1,38 @@
release_tracks: [ALPHA]
command_type: CONFIG_EXPORT
help_text:
brief: Export the configuration for a Redis instance.
description: |
*{command}* exports the configuration for a Redis instance.
Instance configurations can be exported in
Kubernetes Resource Model (krm) or Terraform HCL formats. The
default format is `krm`.
Specifying `--all` allows you to export the configurations for all
instances within the project.
Specifying `--path` allows you to export the configuration(s) to
a local directory.
examples: |
To export the configuration for an instance, run:
$ {command} my-instance
To export the configuration for an instance to a file, run:
$ {command} my-instance --path=/path/to/dir/
To export the configuration for an instance in Terraform
HCL format, run:
$ {command} my-instance --resource-format=terraform
To export the configurations for all instances within a
project, run:
$ {command} --all
arguments:
resource:
help_text: Instance to export the configuration for.
spec: !REF googlecloudsdk.command_lib.redis.resources:instance

View File

@@ -0,0 +1,246 @@
- release_tracks: [ALPHA, BETA, GA]
help_text:
brief: |
Create a Memorystore Redis instance.
description: |
Create a new Redis instance.
This command can fail for the following reasons:
* An instance with the same name already exists.
* The active account does not have permission to create instances.
examples: |
To create a basic tier instance with the name `my-redis-instance` in region `us-central-1`
with memory size of 5 GiB, run:
$ {command} my-redis-instance --region=us-central1 --size=5
arguments:
resource:
spec: !REF googlecloudsdk.command_lib.redis.resources:instance
help_text: |
Arguments and flags that specify the Memorystore Redis instance you want
to create.
params:
- arg_name: zone
api_field: instance.locationId
help_text: |
The zone of the Redis instance. If not provided the service
will pick a random zone in the region. For the standard tier, instances
will be created across two zones for protection against zonal
failures. So if --alternative-zone is also provided, it must be
different from --zone.
- arg_name: alternative-zone
api_field: instance.alternativeLocationId
help_text: |
A secondary zone for the Redis instance. Only applicable to
the standard tier. This protects the instance against zonal failures
by provisioning it across two zones. If provided, alternative zone
must be a different zone from the one provided through `--zone`.
- arg_name: network
api_field: instance.authorizedNetwork
help_text: |
The name of the Google Compute Engine network to which the instance
will be connected. If left unspecified, the default network will be
used.
default: default
processor: googlecloudsdk.command_lib.redis.instances_create_util:ParseInstanceNetworkArg
- arg_name: tier
api_field: instance.tier
help_text: |
The service tier of the instance.
choices:
- enum_value: BASIC
arg_value: basic
help_text: Basic Redis instance with no replication
- enum_value: STANDARD_HA
arg_value: standard
help_text: Standard high-availability Redis instance with replication
default: basic
- arg_name: connect-mode
api_field: instance.connectMode
help_text: |
Network connection mode used by instances.
- arg_name: transit-encryption-mode
api_field: instance.transitEncryptionMode
help_text: |
Transit encryption mode used by the instance.
choices: # Enum is mapped to keep TRANSIT-ENCRYPTION-MODE-UNSPECIFIED invisible from users.
- arg_value: DISABLED
enum_value: DISABLED
help_text: Transit encryption is disabled for the instance.
- arg_value: SERVER-AUTHENTICATION
enum_value: SERVER-AUTHENTICATION
help_text: Client to Server traffic encryption enabled with server authentication.
- arg_name: display-name
api_field: instance.displayName
help_text: |
A human-readable name for the instance.
- api_field: instance.redisConfigs.additionalProperties
metavar: KEY=VALUE
arg_name: redis-config
help_text: |
A list of Redis config KEY=VALUE pairs to set on the instance
according to http://redis.io/topics/config. Currently, the only
supported parameters are:
Redis version 3.2 and newer: maxmemory-policy, notify-keyspace-events, timeout, databases.
Redis version 4.0 and newer: activedefrag, lfu-decay-time, lfu-log-factor, maxmemory-gb.
Redis version 5.0 and newer: stream-node-max-bytes, stream-node-max-entries.
type:
arg_dict:
flatten: true
spec:
- api_field: key
- api_field: value
- arg_name: maintenance-window-day
api_field: instance.maintenancePolicy.weeklyMaintenanceWindow.day
help_text: |
Day of week for maintenance window, in UTC time zone.
MAINTENANCE_WINDOW_DAY must be one of: SUNDAY, MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY, SATURDAY.
- arg_name: maintenance-window-hour
api_field: instance.maintenancePolicy.weeklyMaintenanceWindow.startTime.hours
help_text: |
Hour of day (0 to 23) for maintenance window, in UTC time zone.
- arg_name: persistence-mode
api_field: instance.persistenceConfig.persistenceMode
help_text: |
Operation mode for automated persistence.
choices:
- enum_value: DISABLED
arg_value: disabled
help_text: RDB mode is disabled
- enum_value: RDB
arg_value: RDB
help_text: Automatic RDB persistence
- arg_name: rdb-snapshot-period
api_field: instance.persistenceConfig.rdbSnapshotPeriod
help_text: |
Attempted period between RDB snapshots.
choices:
- enum_value: ONE_HOUR
arg_value: 1h
help_text: 1 hour
- enum_value: SIX_HOURS
arg_value: 6h
help_text: 6 hours
- enum_value: TWELVE_HOURS
arg_value: 12h
help_text: 12 hours
- enum_value: TWENTY_FOUR_HOURS
arg_value: 24h
help_text: 24 hours
- arg_name: rdb-snapshot-start-time
api_field: instance.persistenceConfig.rdbSnapshotStartTime
help_text: |
Date and time of the first snapshot in the ISO 1801 format, and alignment time for future snapshots. For example, 2022-11-02T03:00:00Z.
- arg_name: read-replicas-mode
api_field: instance.readReplicasMode
help_text: |
Read replicas mode used by the instance. Only works against standard tier instances with 5GB
and above provisioned capacity.
choices: # Enum is mapped to keep READ-REPLICAS-MODE-UNSPECIFIED invisible from users.
- enum_value: READ-REPLICAS-DISABLED
arg_value: READ-REPLICAS-DISABLED
help_text: |
Read replica is disabled for the instance. Read endpoint will not
be provided and the instance cannot scale up or down the number of
replicas.
- enum_value: READ-REPLICAS-ENABLED
arg_value: READ-REPLICAS-ENABLED
help_text: |
Read replica is enabled for the instance. Read endpoint will be
provided and the instance can scale up and down the number of
replicas.
- arg_name: replica-count
api_field: instance.replicaCount
type: long
help_text: |
The replica count of the instance.
- arg_name: redis-version
api_field: instance.redisVersion
metavar: VERSION
help_text: The version of Redis software.
choices:
- enum_value: REDIS_3_2
arg_value: redis_3_2
help_text: Redis 3.2 compatibility
- enum_value: REDIS_4_0
arg_value: redis_4_0
help_text: Redis 4.0 compatibility
- enum_value: REDIS_5_0
arg_value: redis_5_0
help_text: Redis 5.0 compatibility
- enum_value: REDIS_6_X
arg_value: redis_6_x
help_text: Redis 6.x compatibility
- enum_value: REDIS_7_0
arg_value: redis_7_0
help_text: Redis 7.0 compatibility
- enum_value: REDIS_7_2
arg_value: redis_7_2
help_text: Redis 7.2 compatibility
- arg_name: reserved-ip-range
api_field: instance.reservedIpRange
help_text: |
For DIRECT_PEERING mode, the CIDR range of internal addresses that are reserved for this
instance. Range must be unique and non-overlapping with existing subnets in an authorized
network. For PRIVATE_SERVICE_ACCESS mode, the name of an IP address range allocated for the
private service access connection. If not provided, the service will choose an unused /29
block, for example, 10.0.0.0/29 or 192.168.0.0/29. If READ_REPLICAS_ENABLED is used for the
--read-replicas-mode flag, then the block size required for this flag is /28.
- arg_name: customer-managed-key
api_field: instance.customerManagedKey
help_text: |
The KMS key reference that you want to use to encrypt the data at rest for this Redis
instance. If this is provided, CMEK is enabled.
- arg_name: size
api_field: instance.memorySizeGb
help_text: |
The memory size of the instance in GiB. If not provided, size of 1 GiB
will be used.
type: long
default: 1
- arg_name: enable-auth
api_field: instance.authEnabled
type: bool
action: store_true
processor: googlecloudsdk.command_lib.redis.util:WarnOnAuthEnabled
help_text: |
Enables Redis AUTH for the instance. If omitted AUTH is disabled.
- arg_name: tags
release_tracks: [GA]
api_field: instance.tags.additionalProperties
# TODO(b/348137430): Remove hidden as part of GA launch.
hidden: true
metavar: KEY=VALUE
help_text: |
List of tag KEY=VALUE pairs to add.
type:
arg_dict:
flatten: true
spec:
- api_field: key
- api_field: value
labels:
api_field: instance.labels
async:
collection: redis.projects.locations.operations
request:
ALPHA:
api_version: v1alpha1
modify_request_hooks:
- googlecloudsdk.command_lib.redis.instances_create_util:AddDefaultReplicaCount
BETA:
api_version: v1beta1
modify_request_hooks:
- googlecloudsdk.command_lib.redis.instances_create_util:AddDefaultReplicaCount
GA:
api_version: v1
modify_request_hooks:
- googlecloudsdk.command_lib.redis.instances_create_util:AddDefaultReplicaCount
collection: redis.projects.locations.instances

View File

@@ -0,0 +1,33 @@
- help_text:
brief: |
Delete a Redis instance.
description: |
Delete a Memorystore Redis instance.
This command can fail for the following reasons:
* The instance specified does not exist.
* The active account does not have permission to access the given
instance.
examples: |
To delete an instance with the name `my-redis-instance` in your default region, run:
$ {command} my-redis-instance
arguments:
resource:
spec: !REF googlecloudsdk.command_lib.redis.resources:instance
help_text: |
Arguments and flags that specify the Memorystore Redis instance you want
to delete.
async:
collection: redis.projects.locations.operations
input:
confirmation_prompt: |
You are about to delete instance [{__name__}] in [{locationsId}].
Any associated data will be lost.
request:
api_version: v1
collection: redis.projects.locations.instances

View File

@@ -0,0 +1,43 @@
- release_tracks: [ALPHA, BETA, GA]
help_text:
brief: |
Show metadata for a Memorystore Redis instance.
description: |
Show metadata for a Memorystore Redis instance.
Displays all metadata associated with a Redis instance given a valid
instance name.
This command can fail for the following reasons:
* The instance specified does not exist.
* The active account does not have permission to access the given
instance.
examples: |
To display the metadata for an instance with the name `my-redis-instance` in the default
region, run:
$ {command} my-redis-instance
arguments:
resource:
spec: !REF googlecloudsdk.command_lib.redis.resources:instance
help_text: |
Arguments and flags that specify the Memorystore Redis instance you want
to describe.
request:
ALPHA:
api_version: v1alpha1
BETA:
api_version: v1beta1
GA:
api_version: v1
collection: redis.projects.locations.instances
response:
ALPHA:
modify_response_hooks:
- googlecloudsdk.command_lib.redis.instances_describe_util:FormatResponse
BETA:
modify_response_hooks:
- googlecloudsdk.command_lib.redis.instances_describe_util:FormatResponse

View File

@@ -0,0 +1,34 @@
- release_tracks: [GA, BETA, ALPHA]
command_type: GENERIC
help_text:
brief: Export data from a Memorystore Redis instance to Google Cloud Storage.
description: |
Export data from a Memorystore Redis instance to Google Cloud Storage.
examples: |
To export the instance with the name `my-redis-instance` in region
`us-central1` to Cloud Storage object
gs://my-bucket/my-redis-instance.rdb run:
$ {command} gs://my-bucket/my-redis-instance.rdb my-redis-instance --region=us-central1
arguments:
resource:
spec: !REF googlecloudsdk.command_lib.redis.resources:instance
help_text: |
Arguments and flags that specify the Memorystore Redis instance you want
to export.
params:
- arg_name: destination
api_field: exportInstanceRequest.outputConfig.gcsDestination.uri
help_text: |
The Cloud Storage object path to export the instance to. Must have
the redis DB file extension *.rdb*.
is_positional: true
async:
collection: redis.projects.locations.operations
request:
collection: redis.projects.locations.instances
api_version: v1
method: export

View File

@@ -0,0 +1,53 @@
release_tracks: [ALPHA, BETA, GA]
help_text:
brief: |
Failover a standard tier Cloud Memorystore for Redis instance from the master node to its
replica.
description: |
Failover a standard tier Cloud Memorystore for Redis instance from the master node to its
replica.
examples: |
To failover an instance with the name 'my-redis-instance' in region 'us-central-1', run:
$ {command} my-redis-instance --region=us-central1
To failover an instance with the name 'my-redis-instance' in region 'us-central-1' without
attempting to limit data loss, run:
$ {command} my-redis-instance --region=us-central1 --data-protection-mode=force-data-loss
arguments:
resource:
spec: !REF googlecloudsdk.command_lib.redis.resources:instance
help_text: |
Arguments and flags that specify the standard tier Cloud Memorystore for Redis instance you
want to failover.
params:
- arg_name: data-protection-mode
api_field: failoverInstanceRequest.dataProtectionMode
choices:
- arg_value: force-data-loss
enum_value: FORCE_DATA_LOSS
help_text: Failover without data loss protection. Can cause significant data loss.
- arg_value: limited-data-loss
enum_value: LIMITED_DATA_LOSS
help_text: Failover with data loss protection that ensures loss is within system thresholds.
help_text: |
Data protection mode to use for the failover. If not specified, defaults to
'limited-data-loss'.
input:
confirmation_prompt: |-
WARNING: Failover can result in the loss of unreplicated data. Using 'force-data-loss' can potentially cause significant data loss. See manual failover documentation for more details.
async:
collection: redis.projects.locations.operations
request:
api_version: v1
collection: redis.projects.locations.instances
method: failover
output:
format: none

View File

@@ -0,0 +1,37 @@
release_tracks: [ALPHA, BETA, GA]
help_text:
brief: |
Show AUTH string for a Memorystore Redis instance.
description: |
Show AUTH string for a Memorystore Redis instance.
Result is empty if AUTH is disabled for the instance.
This command can fail for the following reasons:
* The instance specified does not exist.
* The active account does not have permission to view the AUTH string
examples: |
To display the AUTH string for an instance with the name `my-redis-instance` in the default
region, run:
$ {command} my-redis-instance
arguments:
resource:
spec: !REF googlecloudsdk.command_lib.redis.resources:instance
help_text: |
Arguments and flags that specify the Memorystore Redis instance you want
to view the AUTH string for.
request:
ALPHA:
api_version: v1alpha1
BETA:
api_version: v1beta1
GA:
api_version: v1
collection: redis.projects.locations.instances
method: getAuthString
output:
format: "yaml[private]"

View File

@@ -0,0 +1,34 @@
- release_tracks: [GA, BETA, ALPHA]
command_type: GENERIC
help_text:
brief: Import data to a Memorystore Redis instance from Google Cloud Storage.
description: |
Import data to a Memorystore Redis instance from Google Cloud Storage.
examples: |
To import to the instance with the name `my-redis-instance` in region
`us-central1` from Cloud Storage object
gs://my-bucket/my-redis-instance.rdb run:
$ {command} gs://my-bucket/my-redis-instance.rdb my-redis-instance --region=us-central1
arguments:
resource:
spec: !REF googlecloudsdk.command_lib.redis.resources:instance
help_text: |
Arguments and flags that specify the Memorystore Redis instance you want
to import to.
params:
- arg_name: source
api_field: importInstanceRequest.inputConfig.gcsSource.uri
help_text: |
The Cloud Storage object path to import the instance from. Must have
the redis DB file extension *.rdb*.
is_positional: true
async:
collection: redis.projects.locations.operations
request:
collection: redis.projects.locations.instances
api_version: v1
method: import

View File

@@ -0,0 +1,40 @@
- help_text:
brief: |
List Memorystore Redis instances.
description: |
List all Redis instances under the specified project and region.
To specify the maximum number of instances to list, use the --limit flag.
examples: |
To list up to five instances, run:
$ {command} --limit=5
arguments:
resource:
spec: !REF googlecloudsdk.command_lib.redis.resources:region
help_text: |
The region of the instances to display.
request:
api_version: v1
collection: redis.projects.locations.instances
response:
id_field: name
output:
format: |
table(
name.basename():label=INSTANCE_NAME:sort=2,
redisVersion:label=VERSION,
name.segment(3):label=REGION,
tier,
memorySizeGb:label=SIZE_GB,
host.yesno(no="-"),
port.yesno(no="-"),
authorizedNetwork.basename():label=NETWORK,
reservedIpRange:label=RESERVED_IP,
state:label=STATUS,
createTime.date()
)

View File

@@ -0,0 +1,59 @@
release_tracks: [BETA, ALPHA, GA]
help_text:
brief: |
Reschedule maintenance window for a Redis instance.
description: |
Reschedule maintenance window for a Redis instance.
examples: |
To reschedule maintenance window for an instance with the name 'my-redis-instance' in region
'us-central-1' with next available window, run:
$ {command} my-redis-instance --region=us-central1 --reschedule-type=next-available-window
arguments:
resource:
spec: !REF googlecloudsdk.command_lib.redis.resources:instance
help_text: |
Arguments and flags that specify the Cloud Memorystore for Redis instance you
want to reschedule maintenance window.
params:
- arg_name: reschedule-type
api_field: rescheduleMaintenanceRequest.rescheduleType
required: true
choices:
- arg_value: IMMEDIATE
enum_value: IMMEDIATE
help_text: Reschedule the maintenance window to perform now.
- arg_value: NEXT-AVAILABLE-WINDOW
enum_value: NEXT_AVAILABLE_WINDOW
help_text: Reschedule the maintenance window to the next available window.
- arg_value: SPECIFIC-TIME
enum_value: SPECIFIC_TIME
help_text: Reschedule the maintenance window to a specific time.
help_text: |
Reschedule type to use for the reschedule maintenance window.
Reschedule Type must be one of:IMMEDIATE, NEXT-AVAILABLE-WINDOW, or SPECIFIC-TIME.
- arg_name: schedule-time
api_field: rescheduleMaintenanceRequest.scheduleTime
help_text: |
Time in RFC3339 format, for example: 2012-11-15T16:19:00.094Z
async:
collection: redis.projects.locations.operations
request:
ALPHA:
api_version: v1alpha1
modify_request_hooks:
- googlecloudsdk.command_lib.redis.instances_reschedule_util:CheckSpecificTimeField
BETA:
api_version: v1beta1
modify_request_hooks:
- googlecloudsdk.command_lib.redis.instances_reschedule_util:CheckSpecificTimeField
GA:
api_version: v1
modify_request_hooks:
- googlecloudsdk.command_lib.redis.instances_reschedule_util:CheckSpecificTimeField
collection: redis.projects.locations.instances
method: rescheduleMaintenance

View File

@@ -0,0 +1,202 @@
- release_tracks: [ALPHA, BETA, GA]
help_text:
brief: |
Update Memorystore Redis instances.
description: |
Update the metadata and/or configuration parameters of a Redis instance.
This command can fail for the following reasons:
* The instance specified does not exist.
* The active account does not have permission to update the given
instance.
examples: |
To update a Redis instance with the name `my-redis-instance` to have the display name
"Cache for Foo Service", and add the two labels, `env` and `service`, run:
$ {command} my-redis-instance --display-name="Cache for Foo Service" \
--update-labels=env=test,service=foo
arguments:
resource:
spec: !REF googlecloudsdk.command_lib.redis.resources:instance
help_text: |
Arguments and flags that specify the Memorystore Redis instance you want
to update.
params:
- arg_name: display-name
api_field: instance.displayName
help_text: |
A human-readable name for the instance.
- arg_name: size
api_field: instance.memorySizeGb
type: long
help_text: |
The memory size of the instance in GiB.
- arg_name: enable-auth
api_field: instance.authEnabled
type: bool
action: store_true
help_text: |
Enables Redis AUTH for the instance.
- arg_name: persistence-mode
api_field: instance.persistenceConfig.persistenceMode
help_text: |
Operation mode for automated persistence.
choices:
- enum_value: DISABLED
arg_value: disabled
help_text: RDB mode is disabled
- enum_value: RDB
arg_value: RDB
help_text: Automatic RDB persistence
- arg_name: rdb-snapshot-period
api_field: instance.persistenceConfig.rdbSnapshotPeriod
help_text: |
The attempted period between RDB snapshots.
choices:
- enum_value: ONE_HOUR
arg_value: 1h
help_text: 1 hour
- enum_value: SIX_HOURS
arg_value: 6h
help_text: 6 hours
- enum_value: TWELVE_HOURS
arg_value: 12h
help_text: 12 hours
- enum_value: TWENTY_FOUR_HOURS
arg_value: 24h
help_text: 24 hours
- arg_name: rdb-snapshot-start-time
api_field: instance.persistenceConfig.rdbSnapshotStartTime
help_text: |
Date and time of the first snapshot in the ISO 1801 format, and alignment time for future snapshots. For example, 2022-11-02T03:00:00Z.
- arg_name: replica-count
api_field: instance.replicaCount
type: long
help_text: |
The replica count of the instance. Valid from 0 to 5.
- arg_name: read-replicas-mode
api_field: instance.readReplicasMode
help_text: |
Read replicas mode used by the instance. Only works against standard tier instances with
5GB and above provisioned capacity and Redis version 5.0 and above.
This is an irreversible update i.e. Read replicas can not be disabled for the instance
once it is enabled. Also this update is exclusive and cannot be clubbed with other update
operations.
choices: # Enum is mapped to keep READ-REPLICAS-MODE-UNSPECIFIED invisible from users.
- enum_value: READ-REPLICAS-ENABLED
arg_value: READ-REPLICAS-ENABLED
help_text: |
Read replica is enabled for the instance if not already enabled. Read endpoint will be
provided and the instance can scale up and down the number of replicas.
- enum_value: READ-REPLICAS-DISABLED
arg_value: READ-REPLICAS-DISABLED
help_text: |
If read replica is not enabled on the instance, no changes are done. If read replica is
enabled for the instance, update operation fails
- arg_name: secondary-ip-range
api_field: instance.secondaryIpRange
help_text: |
Required only when read-replicas-mode is enabled on the instance. The CIDR range of
internal addresses that are reserved for this instance. For example, 10.0.0.0/28 or
192.168.0.0/28. Range must be unique and non-overlapping with existing ranges in the
network. If value 'auto' passed, the service will automatically pick an available range.
- arg_name: maintenance-version
api_field: instance.maintenanceVersion
help_text: |
Specifies which maintenance version to apply to your instance during self-service maintenance.
To view the available maintenance versions for your instance, run `gcloud redis
instances describe [INSTANCE_ID]`. Acceptable values for this flag are either `current_default` or
one of the specific versions listed by the describe command. If you pass the value
`current_default`, the Memorystore updates to the most recent available maintenance version during self service maintenance.
- group:
mutex: true
params:
- arg_name: maintenance-window-any
action: store_true
help_text: |
Removes the user-specified maintenance window.
- group:
params:
- arg_name: maintenance-window-day
api_field: instance.maintenancePolicy.weeklyMaintenanceWindow.day
help_text: |
Day of week for maintenance window, in UTC time zone.
MAINTENANCE_WINDOW_DAY must be one of: SUNDAY, MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY, SATURDAY.
- arg_name: maintenance-window-hour
api_field: instance.maintenancePolicy.weeklyMaintenanceWindow.startTime.hours
help_text: |
Hour of day (0 to 23) for maintenance window, in UTC time zone.
additional_arguments_hook: googlecloudsdk.command_lib.redis.util:AdditionalInstanceUpdateArguments
labels:
api_field: instance.labels
async:
collection: redis.projects.locations.operations
request:
ALPHA:
api_version: v1alpha1
modify_request_hooks:
- googlecloudsdk.command_lib.redis.instances_update_util:CheckFieldsSpecifiedAlpha
- googlecloudsdk.command_lib.redis.instances_update_util:AddDisplayName
- googlecloudsdk.command_lib.redis.instances_update_util:AddSize
- googlecloudsdk.command_lib.redis.instances_update_util:RemoveRedisConfigs
- googlecloudsdk.command_lib.redis.instances_update_util:UpdateMaintenanceWindowAny
- googlecloudsdk.command_lib.redis.instances_update_util:UpdateMaintenanceWindowDay
- googlecloudsdk.command_lib.redis.instances_update_util:UpdateMaintenanceWindowHour
- googlecloudsdk.command_lib.redis.instances_update_util:UpdateRedisConfigs
- googlecloudsdk.command_lib.redis.instances_update_util:UpdateAuthEnabled
- googlecloudsdk.command_lib.redis.instances_update_util:UpdatePersistenceMode
- googlecloudsdk.command_lib.redis.instances_update_util:UpdateRdbSnapshotPeriod
- googlecloudsdk.command_lib.redis.instances_update_util:UpdateRdbSnapshotStartTime
- googlecloudsdk.command_lib.redis.instances_update_util:UpdateReplicaCount
- googlecloudsdk.command_lib.redis.instances_update_util:UpdateReadReplicasMode
- googlecloudsdk.command_lib.redis.instances_update_util:UpdateSecondaryIpRange
- googlecloudsdk.command_lib.redis.instances_update_util:UpdateMaintenanceVersion
BETA:
api_version: v1beta1
modify_request_hooks:
- googlecloudsdk.command_lib.redis.instances_update_util:CheckFieldsSpecifiedBeta
- googlecloudsdk.command_lib.redis.instances_update_util:AddDisplayName
- googlecloudsdk.command_lib.redis.instances_update_util:AddSize
- googlecloudsdk.command_lib.redis.instances_update_util:RemoveRedisConfigs
- googlecloudsdk.command_lib.redis.instances_update_util:UpdateMaintenanceWindowAny
- googlecloudsdk.command_lib.redis.instances_update_util:UpdateMaintenanceWindowDay
- googlecloudsdk.command_lib.redis.instances_update_util:UpdateMaintenanceWindowHour
- googlecloudsdk.command_lib.redis.instances_update_util:UpdateRedisConfigs
- googlecloudsdk.command_lib.redis.instances_update_util:UpdateAuthEnabled
- googlecloudsdk.command_lib.redis.instances_update_util:UpdateReplicaCount
- googlecloudsdk.command_lib.redis.instances_update_util:UpdatePersistenceMode
- googlecloudsdk.command_lib.redis.instances_update_util:UpdateRdbSnapshotPeriod
- googlecloudsdk.command_lib.redis.instances_update_util:UpdateRdbSnapshotStartTime
- googlecloudsdk.command_lib.redis.instances_update_util:UpdateReadReplicasMode
- googlecloudsdk.command_lib.redis.instances_update_util:UpdateSecondaryIpRange
- googlecloudsdk.command_lib.redis.instances_update_util:UpdateMaintenanceVersion
GA:
api_version: v1
modify_request_hooks:
- googlecloudsdk.command_lib.redis.instances_update_util:CheckFieldsSpecifiedGA
- googlecloudsdk.command_lib.redis.instances_update_util:AddDisplayName
- googlecloudsdk.command_lib.redis.instances_update_util:AddSize
- googlecloudsdk.command_lib.redis.instances_update_util:RemoveRedisConfigs
- googlecloudsdk.command_lib.redis.instances_update_util:UpdateMaintenanceWindowAny
- googlecloudsdk.command_lib.redis.instances_update_util:UpdateMaintenanceWindowDay
- googlecloudsdk.command_lib.redis.instances_update_util:UpdateMaintenanceWindowHour
- googlecloudsdk.command_lib.redis.instances_update_util:UpdateRedisConfigs
- googlecloudsdk.command_lib.redis.instances_update_util:UpdateAuthEnabled
- googlecloudsdk.command_lib.redis.instances_update_util:UpdatePersistenceMode
- googlecloudsdk.command_lib.redis.instances_update_util:UpdateRdbSnapshotPeriod
- googlecloudsdk.command_lib.redis.instances_update_util:UpdateRdbSnapshotStartTime
- googlecloudsdk.command_lib.redis.instances_update_util:UpdateReplicaCount
- googlecloudsdk.command_lib.redis.instances_update_util:UpdateReadReplicasMode
- googlecloudsdk.command_lib.redis.instances_update_util:UpdateSecondaryIpRange
- googlecloudsdk.command_lib.redis.instances_update_util:UpdateMaintenanceVersion
collection: redis.projects.locations.instances
update:
read_modify_update: true
disable_auto_field_mask: true

View File

@@ -0,0 +1,53 @@
- release_tracks: [ALPHA, BETA, GA]
help_text:
brief:
Upgrade a Memorystore for Redis instance to a specified Redis version.
description: |
Upgrade a Memorystore for Redis instance to a specified Redis version.
examples: |
To upgrade an instance with the name `my-redis-instance` in region
`us-central1` to Redis version 4.0 run:
$ {command} my-redis-instance --region=us-central1 --redis-version=redis_4_0
arguments:
resource:
spec: !REF googlecloudsdk.command_lib.redis.resources:instance
help_text: |
Arguments and flags that specify the Memorystore for Redis instance you want
to upgrade.
params:
- arg_name: redis-version
api_field: upgradeInstanceRequest.redisVersion
required: true
metavar: VERSION
help_text: Target version of Redis software.
choices:
- enum_value: REDIS_4_0
arg_value: redis_4_0
help_text: Redis 4.0 compatibility
- enum_value: REDIS_5_0
arg_value: redis_5_0
help_text: Redis 5.0 compatibility
- enum_value: REDIS_6_X
arg_value: redis_6_x
help_text: Redis 6.x compatibility
- enum_value: REDIS_7_0
arg_value: redis_7_0
help_text: Redis 7.0 compatibility
- enum_value: REDIS_7_2
arg_value: redis_7_2
help_text: Redis 7.2 compatibility
input:
confirmation_prompt: |-
WARNING: Upgrading will cause connection reset for Basic Tier instances and a failover for Standard Tier instances. The instance will also be temporarily unavailable. To prevent data loss, back up your instance before continuing. For more information, see "Behavior during version upgrade" section in the official Memorystore for Redis documentation.
async:
collection: redis.projects.locations.operations
request:
collection: redis.projects.locations.instances
api_version: v1
method: upgrade

View File

@@ -0,0 +1,25 @@
# -*- coding: utf-8 -*- #
# Copyright 2018 Google LLC. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Command group for Cloud Memorystore Redis operations."""
from __future__ import absolute_import
from __future__ import division
from __future__ import unicode_literals
from googlecloudsdk.calliope import base
class Operations(base.Group):
"""Manage Cloud Memorystore Redis operations."""

View File

@@ -0,0 +1,38 @@
- release_tracks: [ALPHA, BETA, GA]
help_text:
brief: |
Cancel a Memorystore Redis import or export operation.
description: |
Cancel a Memorystore Redis import or export operation.
An export operation can be canceled at any time. This does not impact the data or availability
of an instance.
An import operation can also be canceled. Note that the cancellation will result in the
instance recovering with a fully flushed cache.
examples: |
To cancel an operation named `my-redis-operation` in the default region, run:
$ {command} my-redis-operation
arguments:
resource:
spec: !REF googlecloudsdk.command_lib.redis.resources:operation
help_text: |
Arguments and flags that specify the Memorystore Redis operation you want to cancel.
request:
api_version: v1
collection: redis.projects.locations.operations
method: cancel
response:
modify_response_hooks:
- googlecloudsdk.command_lib.redis.operations_util:LogCanceledOperation
input:
confirmation_prompt: |
You are about to cancel [{__name__}].
output:
format: none

View File

@@ -0,0 +1,27 @@
- help_text:
brief: |
Show metadata for a Memorystore Redis operation.
description: |
Display all metadata associated with a Redis operation given a valid
operation name.
This command can fail for the following reasons:
* The operation specified does not exist.
* The active account does not have permission to access the given
operation.
examples: |
To display the metadata for an operation named `my-redis-operation` in the default region,
run:
$ {command} my-redis-operation
arguments:
resource:
spec: !REF googlecloudsdk.command_lib.redis.resources:operation
help_text: |
Arguments and flags that specify the Memorystore Redis operation you
want to describe.
request:
api_version: v1
collection: redis.projects.locations.operations

View File

@@ -0,0 +1,38 @@
- help_text:
brief: |
List Memorystore Redis operations.
description: |
List all Redis operations under the specified project and region.
To specify the maximum number of operations to list, use the --limit flag.
examples: |
To list up to five operations, run:
$ {command} --limit=5
arguments:
resource:
spec: !REF googlecloudsdk.command_lib.redis.resources:region
help_text: |
The region of the operations to display.
request:
api_version: v1
collection: redis.projects.locations.operations
response:
id_field: name
modify_response_hooks:
- googlecloudsdk.command_lib.redis.operations_util:FilterListResponse
output:
format: |
table(
name.basename():label=OPERATION_NAME,
name.segment(3):label=REGION,
metadata.verb:label=TYPE,
metadata.target.basename(),
done,
metadata.createTime.date():sort=1,
duration(start=metadata.createTime,end=metadata.endTime,precision=0,calendar=false).slice(2:).join("").yesno(no="<1S"):label=DURATION
)

View File

@@ -0,0 +1,25 @@
# -*- coding: utf-8 -*- #
# Copyright 2018 Google LLC. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Command group for Cloud Memorystore Redis regions."""
from __future__ import absolute_import
from __future__ import division
from __future__ import unicode_literals
from googlecloudsdk.calliope import base
class Regions(base.Group):
"""Manage Cloud Memorystore Redis regions."""

View File

@@ -0,0 +1,26 @@
- help_text:
brief: |
Show metadata for a Memorystore Redis region.
description: |
Display all metadata associated with a Redis region given a valid
region name.
This command can fail for the following reasons:
* The region specified does not exist.
* The active account does not have permission to access the given
region.
examples: |
To display the metadata for the region `us-central1`, run:
$ {command} us-central1
arguments:
resource:
spec: !REF googlecloudsdk.command_lib.redis.resources:region_without_property
help_text: |
Arguments and flags that specify the Memorystore Redis region you
want to describe.
request:
api_version: v1
collection: redis.projects.locations

View File

@@ -0,0 +1,28 @@
- help_text:
brief: |
List Memorystore Redis regions
description: |
List all regions where Memorystore Redis API is available.
examples: |
To list all the regions where Redis instances can be created, run:
$ {command}
arguments:
resource:
spec: !REF googlecloudsdk.command_lib.redis.resources:project
help_text: |
The project name.
request:
api_version: v1
collection: redis.projects.locations
response:
id_field: name
output:
format: |
table(
locationId:label=NAME:sort=1
)

View File

@@ -0,0 +1,25 @@
# -*- coding: utf-8 -*- #
# Copyright 2018 Google LLC. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Command group for Cloud Memorystore Redis zones."""
from __future__ import absolute_import
from __future__ import division
from __future__ import unicode_literals
from googlecloudsdk.calliope import base
class Zones(base.Group):
"""Manage Cloud Memorystore Redis zones."""

View File

@@ -0,0 +1,37 @@
- help_text:
brief: |
List Memorystore Redis zones
description: |
List all zones where Memorystore Redis API is available.
examples: |
To list all the zones where Redis instances can be created, run:
$ {command}
arguments:
resource:
spec: !REF googlecloudsdk.command_lib.redis.resources:project
help_text: |
The project name.
params:
- arg_name: region
help_text: |
If provided, returns only resources from the given region. Use region
ID only, not the full URI of the region. This flag is the equivalent
of: `--filter="region:REGION"`. Run `gcloud topic filters` for more
information.
request:
api_version: v1
collection: redis.projects.locations
response:
modify_response_hooks:
- googlecloudsdk.command_lib.redis.zones_util:ExtractZonesFromRegionsListResponse
output:
format: |
table(
name:label=ZONE:sort=1,
region
)