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,38 @@
# -*- 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.
"""The command group for the microservices CLI."""
from __future__ import absolute_import
from __future__ import division
from __future__ import unicode_literals
from googlecloudsdk.calliope import base
@base.Hidden
@base.ReleaseTracks(base.ReleaseTrack.ALPHA)
class Microservices(base.Group):
"""Manage microservices functionalities.
{command} group lets you manage functionalities for microservices on
the Google Cloud Platform.
"""
category = base.MICROSERVICES_CATEGORY
def Filter(self, context, args):
# TODO(b/190537535): Determine if command group works with project number
base.RequireProjectID(args)
del context, args

View File

@@ -0,0 +1,35 @@
# -*- 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 microservices features."""
from __future__ import absolute_import
from __future__ import division
from __future__ import unicode_literals
from googlecloudsdk.calliope import base
SUPPORTED_FEATURES = ['observability']
@base.Hidden
@base.ReleaseTracks(base.ReleaseTrack.ALPHA)
class Policies(base.Group):
"""Manage the microservices features."""
detailed_help = {
'DESCRIPTION': """\
Manage the microservices features.
"""
}

View File

@@ -0,0 +1,55 @@
# -*- 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 to enable a microservices feature."""
from __future__ import absolute_import
from __future__ import division
from __future__ import unicode_literals
from googlecloudsdk.api_lib.microservices import util
from googlecloudsdk.calliope import base
from googlecloudsdk.core import properties
from surface.microservices.features import SUPPORTED_FEATURES
class Disable(base.DeleteCommand):
"""Disable a microservices feature.
This command can fail for the following reasons:
* The feature specified does not exist.
* The active account does not have permission to disable the feature.
## EXAMPLES
The following command disables the `observability` feature:
$ {command} observability
"""
@staticmethod
def Args(parser):
parser.add_argument(
'feature',
choices=SUPPORTED_FEATURES,
help='Name of the feature to be disabled.')
def Run(self, args):
project = properties.VALUES.core.project.Get()
parent = 'projects/' + project + '/locations/global'
client = util.GetClientInstance()
message_module = util.GetMessagesModule()
request = message_module.MicroservicesProjectsLocationsFeaturesDeleteRequest(
name=parent + '/features/' + args.feature)
return client.projects_locations_features.Delete(request)

View File

@@ -0,0 +1,58 @@
# -*- 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 to enable a microservices feature."""
from __future__ import absolute_import
from __future__ import division
from __future__ import unicode_literals
from googlecloudsdk.api_lib.microservices import util
from googlecloudsdk.calliope import base
from googlecloudsdk.core import properties
from surface.microservices.features import SUPPORTED_FEATURES
class Enable(base.CreateCommand):
"""Enable a microservices feature.
This command can fail for the following reasons:
* The feature specified does not exist.
* The active account does not have permission to enable the feature.
## EXAMPLES
The following command enables the `observability` feature:
$ {command} observability
"""
@staticmethod
def Args(parser):
parser.add_argument(
'feature',
choices=SUPPORTED_FEATURES,
help='Name of the feature to be enabled.')
def Run(self, args):
project = properties.VALUES.core.project.Get()
parent = 'projects/' + project + '/locations/global'
client = util.GetClientInstance()
message_module = util.GetMessagesModule()
request = message_module.MicroservicesProjectsLocationsFeaturesCreateRequest(
parent=parent,
featureId=args.feature,
feature=message_module.Feature(name=parent + '/features/' +
args.feature))
return client.projects_locations_features.Create(request)

View File

@@ -0,0 +1,57 @@
# -*- 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.
"""'microservices features list' command."""
from __future__ import absolute_import
from __future__ import division
from __future__ import unicode_literals
from apitools.base.py import list_pager
from googlecloudsdk.api_lib.microservices import util
from googlecloudsdk.calliope import base
from googlecloudsdk.core import properties
DETAILED_HELP = {
'DESCRIPTION':
"""
List enabled microservices features.
""",
'EXAMPLES':
"""
To list enabled microservices features, run:
$ {command}
""",
}
@base.ReleaseTracks(base.ReleaseTrack.ALPHA)
class List(base.ListCommand):
"""Request for listing enabled features."""
def Run(self, args):
project = properties.VALUES.core.project.Get()
parent = 'projects/' + project + '/locations/global'
client = util.GetClientInstance()
message_module = util.GetMessagesModule()
request = message_module.MicroservicesProjectsLocationsFeaturesListRequest(
parent=parent
)
return list_pager.YieldFromList(
client.projects_locations_features,
request,
field='features',
limit=args.limit,
batch_size_attribute='pageSize')