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,25 @@
# -*- 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.
"""Configurations command group."""
from googlecloudsdk.calliope import base
@base.Hidden
@base.UniverseCompatible
@base.ReleaseTracks(base.ReleaseTrack.GA)
class UniverseDescriptors(base.Group):
"""Manage the universe descriptor data."""

View File

@@ -0,0 +1,57 @@
# -*- 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 to create a universe descriptor data entry in the cache."""
from googlecloudsdk.calliope import base
from googlecloudsdk.core import log
from googlecloudsdk.core.universe_descriptor import universe_descriptor
@base.UniverseCompatible
class Create(base.Command):
"""Create a new universe descriptor data entry."""
@staticmethod
def Args(parser):
"""Adds args for this command."""
parser.add_argument(
'universe_domain',
help='Universe domain of the universe descriptor to add to the cache.',
)
def Run(self, args):
del self
universe_descriptor_obj = universe_descriptor.UniverseDescriptor()
try:
universe_descriptor_obj.Get(
args.universe_domain, fetch_if_not_cached=False
)
except universe_descriptor.UniverseDescriptorError:
pass
else:
log.error(
'Universe descriptor with universe domain [%s] already cached.',
args.universe_domain,
)
return
universe_descriptor_obj.UpdateDescriptorFromUniverseDomain(
args.universe_domain
)
log.status.Print(
'Universe descriptor with universe domain [%s] cached.'
% args.universe_domain,
)

View File

@@ -0,0 +1,56 @@
# -*- 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 to delete universe descriptor data."""
from googlecloudsdk.calliope import base
from googlecloudsdk.core import log
from googlecloudsdk.core.console import console_io
from googlecloudsdk.core.universe_descriptor import universe_descriptor
@base.Hidden
@base.UniverseCompatible
class Delete(base.Command):
"""Delete universe descriptor data."""
@staticmethod
def Args(parser):
"""Adds args for this command."""
parser.add_argument(
'universe_domain',
help='Universe domain of the descriptor to delete.',
)
def Run(self, args):
del self
universe_descriptor_obj = universe_descriptor.UniverseDescriptor()
log.warning(
'The universe descriptor with universe domain [%s] will be deleted:',
args.universe_domain,
)
console_io.PromptContinue(default=True, cancel_on_no=True)
try:
universe_descriptor_obj.DeleteDescriptorFromUniverseDomain(
args.universe_domain
)
log.DeletedResource(
'Universe descriptor with universe domain [%s]' % args.universe_domain
)
except universe_descriptor.UniverseDescriptorError:
log.warning(
'No descriptor found for universe domain [%s].', args.universe_domain
)
return

View File

@@ -0,0 +1,51 @@
# -*- 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 to describe universe descriptor data."""
from cloudsdk.google.protobuf import json_format
from googlecloudsdk.calliope import base
from googlecloudsdk.core.universe_descriptor import universe_descriptor
@base.Hidden
@base.UniverseCompatible
class Describe(base.Command):
"""Describe universe descriptor data dict in the cache."""
detailed_help = {
'EXAMPLES': """\
To describe an existing universe descriptor with domain `my-universe-domain.com`, run:
$ {command} my-universe-domain.com
""",
}
@staticmethod
def Args(parser):
"""Adds args for this command."""
parser.add_argument(
'universe_domain',
help='Universe domain of the universe descriptor to describe.',
)
def Run(self, args):
del self
universe_descriptor_obj = universe_descriptor.UniverseDescriptor()
descriptor_json = universe_descriptor_obj.Get(
args.universe_domain, fetch_if_not_cached=False
)
return json_format.MessageToDict(
descriptor_json, always_print_fields_with_no_presence=True
)

View File

@@ -0,0 +1,52 @@
# -*- 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 to list cached universe descriptors."""
import sqlite3
from googlecloudsdk.calliope import base
from googlecloudsdk.core import config
from googlecloudsdk.core.universe_descriptor import universe_descriptor
@base.UniverseCompatible
class List(base.ListCommand):
"""List cached universe descriptors."""
@staticmethod
def Args(parser):
base.PAGE_SIZE_FLAG.RemoveFromParser(parser)
base.URI_FLAG.RemoveFromParser(parser)
table_format = """table(
universe_domain,
universe_short_name,
project_prefix,
authentication_domain,
cloud_web_domain,
version)
"""
parser.display_info.AddFormat(table_format)
def Run(self, unused_args):
config_universe_domains = universe_descriptor.GetAllConfigUniverseDomains()
config_store = config.GetConfigStore(
universe_descriptor.CONFIG_CACHE_DESCRIPTOR_DATA_TABLE_NAME
)
for universe_domain in config_universe_domains:
try:
yield config_store.GetJSON(universe_domain)
except sqlite3.Error:
pass

View File

@@ -0,0 +1,56 @@
# -*- 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 to update a universe descriptor data entry in the cache."""
from googlecloudsdk.calliope import base
from googlecloudsdk.core import log
from googlecloudsdk.core.universe_descriptor import universe_descriptor
@base.UniverseCompatible
class Update(base.Command):
"""Update universe descriptor data in the cache."""
@staticmethod
def Args(parser):
"""Adds args for this command."""
parser.add_argument(
'universe_domain',
help=(
'Universe domain of the universe descriptor to update in the cache.'
),
)
def Run(self, args):
"""Run the update command."""
del self
universe_descriptor_obj = universe_descriptor.UniverseDescriptor()
try:
universe_descriptor_obj.Get(
args.universe_domain, fetch_if_not_cached=False
)
except universe_descriptor.UniverseDescriptorError:
log.error(
'Universe descriptor with universe domain [%s] is not cached.',
args.universe_domain,
)
else:
universe_descriptor_obj.UpdateDescriptorFromUniverseDomain(
args.universe_domain
)
log.status.Print(
'Universe descriptor with universe domain [%s] updated.'
% args.universe_domain,
)