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,30 @@
# -*- coding: utf-8 -*- #
# Copyright 2023 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.
"""The gcloud Firestore backups command group."""
from __future__ import absolute_import
from __future__ import division
from __future__ import unicode_literals
from googlecloudsdk.calliope import base
@base.DefaultUniverseOnly
@base.ReleaseTracks(
base.ReleaseTrack.ALPHA, base.ReleaseTrack.BETA, base.ReleaseTrack.GA
)
class Backups(base.Group):
"""The set of commands to manage backups for Cloud Firestore."""
pass

View File

@@ -0,0 +1,47 @@
# -*- coding: utf-8 -*- #
# Copyright 2023 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.
"""The gcloud Firestore backups delete command."""
from __future__ import absolute_import
from __future__ import division
from __future__ import unicode_literals
from googlecloudsdk.api_lib.firestore import backups
from googlecloudsdk.calliope import base
from googlecloudsdk.command_lib.firestore import flags
from googlecloudsdk.core import properties
@base.DefaultUniverseOnly
class Delete(base.DeleteCommand):
"""Deletes a Cloud Firestore backup.
## EXAMPLES
To delete `cf9f748a-7980-4703-b1a1-d1ffff591db0` backup in us-east1.
$ {command} --location=us-east1
--backup=cf9f748a-7980-4703-b1a1-d1ffff591db0
"""
@staticmethod
def Args(parser):
flags.AddLocationFlag(parser, required=True)
flags.AddBackupFlag(parser)
def Run(self, args):
project = properties.VALUES.core.project.Get(required=True)
return backups.DeleteBackup(project, args.location, args.backup)

View File

@@ -0,0 +1,48 @@
# -*- coding: utf-8 -*- #
# Copyright 2023 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.
"""The gcloud Firestore backups describe command."""
from __future__ import absolute_import
from __future__ import division
from __future__ import unicode_literals
from googlecloudsdk.api_lib.firestore import backups
from googlecloudsdk.calliope import base
from googlecloudsdk.command_lib.firestore import flags
from googlecloudsdk.core import properties
@base.DefaultUniverseOnly
class Describe(base.DescribeCommand):
"""Retrieves information about a Cloud Firestore backup.
## EXAMPLES
To retrieve information about the `cf9f748a-7980-4703-b1a1-d1ffff591db0`
backup in us-east1.
$ {command} --location=us-east1
--backup=cf9f748a-7980-4703-b1a1-d1ffff591db0
"""
@staticmethod
def Args(parser):
flags.AddLocationFlag(parser, required=True)
flags.AddBackupFlag(parser)
def Run(self, args):
project = properties.VALUES.core.project.Get(required=True)
return backups.GetBackup(project, args.location, args.backup)

View File

@@ -0,0 +1,49 @@
# -*- coding: utf-8 -*- #
# Copyright 2023 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.
"""The gcloud Firestore backups list command."""
from __future__ import absolute_import
from __future__ import division
from __future__ import unicode_literals
from googlecloudsdk.api_lib.firestore import backups
from googlecloudsdk.calliope import base
from googlecloudsdk.command_lib.firestore import flags
from googlecloudsdk.core import properties
@base.DefaultUniverseOnly
class List(base.ListCommand):
"""List backups available to Cloud Firestore.
## EXAMPLES
To list all backups in location us-east1.
$ {command} --location=us-east1 --format="table(name, database, state)"
To list all backups in all location.
$ {command} --format="table(name, database, state)"
"""
@staticmethod
def Args(parser):
flags.AddLocationFlag(parser)
def Run(self, args):
project = properties.VALUES.core.project.Get(required=True)
location = '-' if args.location is None else args.location
return backups.ListBackups(project, location)

View File

@@ -0,0 +1,29 @@
# -*- coding: utf-8 -*- #
# Copyright 2023 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.
"""The gcloud firestore backups schedules command group."""
from __future__ import absolute_import
from __future__ import division
from __future__ import unicode_literals
from googlecloudsdk.calliope import base
@base.DefaultUniverseOnly
@base.ReleaseTracks(
base.ReleaseTrack.ALPHA, base.ReleaseTrack.BETA, base.ReleaseTrack.GA
)
class Schedules(base.Group):
"""Manage the backup schedules for a Cloud Firestore Database."""

View File

@@ -0,0 +1,63 @@
# -*- coding: utf-8 -*- #
# Copyright 2023 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 to create a backup schedule for a Firestore Database."""
from __future__ import absolute_import
from __future__ import division
from __future__ import unicode_literals
from googlecloudsdk.api_lib.firestore import backup_schedules
from googlecloudsdk.calliope import base
from googlecloudsdk.command_lib.firestore import flags
from googlecloudsdk.core import properties
@base.DefaultUniverseOnly
class Create(base.Command):
"""Creates a Cloud Firestore backup schedule.
## EXAMPLES
To create a backup schedule with 7 days retention and daily recurrence under
database testdb.
$ {command} --database=testdb
--retention=7d
--recurrence=daily
To create a backup schedule with 7 days retention and weekly recurrence on
Monday under database testdb.
$ {command} --database=testdb
--retention=7d
--recurrence=weekly
--day-of-week=MON
"""
@staticmethod
def Args(parser):
flags.AddDatabaseIdFlag(parser, required=True)
flags.AddRetentionFlag(parser, required=True)
flags.AddRecurrenceFlag(parser)
def Run(self, args):
project = properties.VALUES.core.project.Get(required=True)
return backup_schedules.CreateBackupSchedule(
project,
args.database,
args.retention,
args.recurrence,
args.day_of_week,
)

View File

@@ -0,0 +1,50 @@
# -*- coding: utf-8 -*- #
# Copyright 2023 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 to delete a backup schedule for a Firestore Database."""
from __future__ import absolute_import
from __future__ import division
from __future__ import unicode_literals
from googlecloudsdk.api_lib.firestore import backup_schedules
from googlecloudsdk.calliope import base
from googlecloudsdk.command_lib.firestore import flags
from googlecloudsdk.core import properties
@base.DefaultUniverseOnly
class Delete(base.Command):
"""Deletes a Cloud Firestore backup schedule.
## EXAMPLES
To delete backup schedule 'cf9f748a-7980-4703-b1a1-d1ffff591db0' under
database testdb.
$ {command} --database='testdb'
--backup-schedule='cf9f748a-7980-4703-b1a1-d1ffff591db0'
"""
@staticmethod
def Args(parser):
"""Set args for gcloud firestore backups schedules delete."""
flags.AddDatabaseIdFlag(parser, required=True)
flags.AddBackupScheduleFlag(parser)
def Run(self, args):
project = properties.VALUES.core.project.Get(required=True)
return backup_schedules.DeleteBackupSchedule(
project, args.database, args.backup_schedule
)

View File

@@ -0,0 +1,50 @@
# -*- coding: utf-8 -*- #
# Copyright 2023 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 to describe a backup schedule for a Firestore Database."""
from __future__ import absolute_import
from __future__ import division
from __future__ import unicode_literals
from googlecloudsdk.api_lib.firestore import backup_schedules
from googlecloudsdk.calliope import base
from googlecloudsdk.command_lib.firestore import flags
from googlecloudsdk.core import properties
@base.DefaultUniverseOnly
class Describe(base.DescribeCommand):
"""Describes a Cloud Firestore backup schedule.
## EXAMPLES
To describe backup schedule 'cf9f748a-7980-4703-b1a1-d1ffff591db0' under
database testdb.
$ {command} --database='testdb'
--backup-schedule='cf9f748a-7980-4703-b1a1-d1ffff591db0'
"""
@staticmethod
def Args(parser):
"""Set args for gcloud firestore backups schedules describe."""
flags.AddDatabaseIdFlag(parser, required=True)
flags.AddBackupScheduleFlag(parser)
def Run(self, args):
project = properties.VALUES.core.project.Get(required=True)
return backup_schedules.GetBackupSchedule(
project, args.database, args.backup_schedule
)

View File

@@ -0,0 +1,44 @@
# -*- coding: utf-8 -*- #
# Copyright 2023 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 to list backup schedules for a Firestore Database."""
from __future__ import absolute_import
from __future__ import division
from __future__ import unicode_literals
from googlecloudsdk.api_lib.firestore import backup_schedules
from googlecloudsdk.calliope import base
from googlecloudsdk.command_lib.firestore import flags
from googlecloudsdk.core import properties
@base.DefaultUniverseOnly
class List(base.ListCommand):
"""Lists backup schedules under a Cloud Firestore database.
## EXAMPLES
To list all backup schedules under database testdb.
$ {command} --database='testdb'
"""
@staticmethod
def Args(parser):
flags.AddDatabaseIdFlag(parser, required=True)
def Run(self, args):
project = properties.VALUES.core.project.Get(required=True)
return backup_schedules.ListBackupSchedules(project, args.database)

View File

@@ -0,0 +1,52 @@
# -*- coding: utf-8 -*- #
# Copyright 2023 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 to update a backup schedule for a Firestore Database."""
from __future__ import absolute_import
from __future__ import division
from __future__ import unicode_literals
from googlecloudsdk.api_lib.firestore import backup_schedules
from googlecloudsdk.calliope import base
from googlecloudsdk.command_lib.firestore import flags
from googlecloudsdk.core import properties
@base.DefaultUniverseOnly
class Update(base.Command):
"""Updates a Cloud Firestore backup schedule.
## EXAMPLES
To update backup schedule 'cf9f748a-7980-4703-b1a1-d1ffff591db0' under
database testdb to 7 days retention.
$ {command} --database='testdb'
--backup-schedule='cf9f748a-7980-4703-b1a1-d1ffff591db0'
--retention='7d'
"""
@staticmethod
def Args(parser):
"""Set args for gcloud firestore backups schedules update."""
flags.AddDatabaseIdFlag(parser, required=True)
flags.AddBackupScheduleFlag(parser)
flags.AddRetentionFlag(parser)
def Run(self, args):
project = properties.VALUES.core.project.Get(required=True)
return backup_schedules.UpdateBackupSchedule(
project, args.database, args.backup_schedule, args.retention
)