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,26 @@
# -*- coding: utf-8 -*- #
# Copyright 2015 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 super-group for commands to inspect APIs in gcloud."""
from __future__ import absolute_import
from __future__ import division
from __future__ import unicode_literals
from googlecloudsdk.calliope import base
class Methods(base.Group):
"""Inspect the methods for an API collection registered in gcloud."""

View File

@@ -0,0 +1,53 @@
# -*- coding: utf-8 -*- #
# Copyright 2015 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.
"""A command that describes a registered gcloud API."""
from __future__ import absolute_import
from __future__ import division
from __future__ import unicode_literals
from googlecloudsdk.calliope import base
from googlecloudsdk.command_lib.meta.apis import flags
from googlecloudsdk.core import properties
ENFORCE_COLLECTION_FLAG = base.Argument(
'--enforce-collection',
action='store_true',
default=True,
help='Fail unless resource belongs to specified collection. '
'This is applicable only if method being called is GET or DELETE '
'and resource identifier is URL.')
class Call(base.Command):
"""Calls an API method with specific parameters."""
@staticmethod
def Args(parser):
flags.API_VERSION_FLAG.AddToParser(parser)
flags.COLLECTION_FLAG.AddToParser(parser)
ENFORCE_COLLECTION_FLAG.AddToParser(parser)
flags.RAW_FLAG.AddToParser(parser)
parser.AddDynamicPositional(
'method',
action=flags.MethodDynamicPositionalAction,
help='The name of the API method to invoke.')
def Run(self, args):
properties.VALUES.core.enable_gri.Set(True)
response = args.method.Call()
return response

View File

@@ -0,0 +1,41 @@
# -*- coding: utf-8 -*- #
# Copyright 2015 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.
"""A command that describes a resource collection for a given API."""
from __future__ import absolute_import
from __future__ import division
from __future__ import unicode_literals
from googlecloudsdk.calliope import base
from googlecloudsdk.command_lib.meta.apis import flags
from googlecloudsdk.command_lib.util.apis import registry
class Describe(base.DescribeCommand):
"""Describe the details of a collection for an API."""
@staticmethod
def Args(parser):
flags.API_VERSION_FLAG.AddToParser(parser)
flags.COLLECTION_FLAG.AddToParser(parser)
parser.add_argument(
'method',
completer=flags.MethodCompleter,
help='The name of the method to get the details of.')
def Run(self, args):
return registry.GetMethod(args.collection, args.method,
api_version=args.api_version)

View File

@@ -0,0 +1,76 @@
# -*- coding: utf-8 -*- #
# Copyright 2015 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.
"""A command that lists the resource collections for a given API."""
from __future__ import absolute_import
from __future__ import division
from __future__ import unicode_literals
import itertools
from googlecloudsdk.calliope import base
from googlecloudsdk.command_lib.meta.apis import flags
from googlecloudsdk.command_lib.util.apis import registry
class List(base.ListCommand):
"""List the methods of a resource collection for an API."""
@staticmethod
def Args(parser):
base.PAGE_SIZE_FLAG.RemoveFromParser(parser)
base.URI_FLAG.RemoveFromParser(parser)
collection_flag = base.Argument(
'--collection',
completer=flags.CollectionCompleter,
help='The name of the collection for which to list methods.\n'
'If left blank, returns methods from all collections.')
collection_flag.AddToParser(parser)
flags.API_VERSION_FLAG.AddToParser(parser)
api_flag = base.Argument(
'--api',
completer=flags.APICompleter,
help=('The name of the API to get the methods for. If `--api-version` '
'is also supplied, then returns methods from specified version, '
'otherwise returns methods from all versions of this API.'))
api_flag.AddToParser(parser)
parser.display_info.AddFormat("""
table(
name:sort=1,
detailed_path:optional,
http_method,
request_type,
response_type
)
""")
def Run(self, args):
if not args.collection:
if args.api:
collections = [registry.GetAPICollections(args.api, args.api_version)]
else:
collections = [
registry.GetAPICollections(api.name, api.version)
for api in registry.GetAllAPIs()
]
collections = list(itertools.chain.from_iterable(collections))
methods = [registry.GetMethods(collection.full_name,
api_version=collection.api_version)
for collection in collections]
methods = list(itertools.chain.from_iterable(methods))
return methods
return registry.GetMethods(args.collection, api_version=args.api_version)