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 2025 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 Artifact Registry platform logs."""
from __future__ import absolute_import
from __future__ import division
from __future__ import unicode_literals
from googlecloudsdk.calliope import base
@base.ReleaseTracks(base.ReleaseTrack.GA)
@base.Hidden
@base.UniverseCompatible
class PlatformLogs(base.Group):
"""Manage Artifact Registry Platform Logs configurations."""
category = base.TOOLS_CATEGORY

View File

@@ -0,0 +1,67 @@
# -*- coding: utf-8 -*- #
# Copyright 2025 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 clear Artifact Registry Platform Logs configuration."""
from googlecloudsdk.api_lib.util import apis
from googlecloudsdk.calliope import base
from googlecloudsdk.command_lib.artifacts import flags
from googlecloudsdk.command_lib.artifacts import platformlogs_util
from googlecloudsdk.core import log
@base.ReleaseTracks(base.ReleaseTrack.GA)
@base.Hidden
@base.UniverseCompatible
class Clear(base.UpdateCommand):
"""Clear the Platform Logs configuration."""
api_version = 'v1'
detailed_help = {
'DESCRIPTION': '{description}',
'EXAMPLES': """
To clear the Platform Logs configuration for the project 'my-project' in us-west1 (move project to default state):
$ {command} --project=my-project --location=us-west1
To clear the Platform Logs configuration for the repository 'my-repo' in us-west1 (fall back to project-level logging configuration):
$ {command} --project=my-project --location=us-west1 --repository=my-repo
""",
}
@staticmethod
def Args(parser):
"""Set up arguments for this command.
Args:
parser: An argparse.ArgumentPaser.
"""
flags.GetPlainRepoFlag().AddToParser(parser)
flags.GetPlainLocationFlag().AddToParser(parser)
def Run(self, args):
"""Run the clear command."""
client = apis.GetClientInstance('artifactregistry', self.api_version)
messages = client.MESSAGES_MODULE
platform_logs_config = messages.PlatformLogsConfig()
response = platformlogs_util.UpdatePlatformLogsConfig(
args, client, messages, platform_logs_config
)
log.status.Print(
'Cleared Platform Logs Config for [{}].'.format(response.name)
)
return response

View File

@@ -0,0 +1,58 @@
# -*- coding: utf-8 -*- #
# Copyright 2025 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 Artifact Registry Platform Logs configuration."""
from googlecloudsdk.api_lib.util import apis
from googlecloudsdk.calliope import base
from googlecloudsdk.command_lib.artifacts import flags
from googlecloudsdk.command_lib.artifacts import platformlogs_util
@base.ReleaseTracks(base.ReleaseTrack.GA)
@base.Hidden
@base.UniverseCompatible
class Describe(base.DescribeCommand):
"""Describe the current Platform Logs configuration."""
api_version = 'v1'
detailed_help = {
'DESCRIPTION': '{description}',
'EXAMPLES': """\
To describe the Platform Logs configuration for the project 'my-project' in us-west1:
$ {command} --project=my-project --location=us-west1
To describe the Platform Logs configuration for the repository 'my-repo' in us-west1:
$ {command} --project=my-project --location=us-west1 --repository=my-repo
""",
}
@staticmethod
def Args(parser):
"""Set up arguments for this command.
Args:
parser: An argparse.ArgumentPaser.
"""
flags.GetPlainRepoFlag().AddToParser(parser)
flags.GetPlainLocationFlag().AddToParser(parser)
def Run(self, args):
"""Run the describe command."""
client = apis.GetClientInstance('artifactregistry', self.api_version)
messages = client.MESSAGES_MODULE
return platformlogs_util.GetPlatformLogsConfig(args, client, messages)

View File

@@ -0,0 +1,66 @@
# -*- coding: utf-8 -*- #
# Copyright 2025 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 disable Artifact Registry Platform Logs configuration."""
from googlecloudsdk.api_lib.util import apis
from googlecloudsdk.calliope import base
from googlecloudsdk.command_lib.artifacts import flags
from googlecloudsdk.command_lib.artifacts import platformlogs_util
from googlecloudsdk.core import log
@base.ReleaseTracks(base.ReleaseTrack.GA)
@base.Hidden
@base.UniverseCompatible
class Disable(base.UpdateCommand):
"""Disable the Platform Logs configuration."""
api_version = 'v1'
detailed_help = {
'DESCRIPTION': '{description}',
'EXAMPLES': """
To disable Platform Logs for the project 'my-project' in us-west1:
$ {command} --project=my-project --location=us-west1
To disable Platform Logs for the repository 'my-repo' in us-west1:
$ {command} --project=my-project --location=us-west1 --repository=my-repo
""",
}
@staticmethod
def Args(parser):
"""Set up arguments for this command.
Args:
parser: An argparse.ArgumentPaser.
"""
flags.GetPlainRepoFlag().AddToParser(parser)
flags.GetPlainLocationFlag().AddToParser(parser)
def Run(self, args):
"""Run the disable command."""
client = apis.GetClientInstance('artifactregistry', self.api_version)
messages = client.MESSAGES_MODULE
platform_logs_config = messages.PlatformLogsConfig(
loggingState=messages.PlatformLogsConfig.LoggingStateValueValuesEnum.DISABLED,
)
response = platformlogs_util.UpdatePlatformLogsConfig(
args, client, messages, platform_logs_config
)
log.status.Print('Disabled Platform Logs for [{}].'.format(response.name))
return response

View File

@@ -0,0 +1,88 @@
# -*- coding: utf-8 -*- #
# Copyright 2025 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 Artifact Registry Platform Logs configuration."""
from googlecloudsdk.api_lib.util import apis
from googlecloudsdk.calliope import base
from googlecloudsdk.command_lib.artifacts import flags
from googlecloudsdk.command_lib.artifacts import platformlogs_util
from googlecloudsdk.core import log
@base.ReleaseTracks(base.ReleaseTrack.GA)
@base.Hidden
@base.UniverseCompatible
class Enable(base.UpdateCommand):
"""Enable the Platform Logs configuration."""
api_version = 'v1'
detailed_help = {
'DESCRIPTION': '{description}',
'EXAMPLES': """
To enable Platform Logs for the project 'my-project' in us-west1 for all severity levels:
$ {command} --project=my-project --location=us-west1
To enable Platform Logs for the project 'my-project' in us-west1 for INFO level and above:
$ {command} --project=my-project --location=us-west1 --severity=INFO
To enable Platform Logs for the repository 'my-repo' in us-west1 for all severity levels:
$ {command} --project=my-project --location=us-west1 --repository=my-repo
To enable Platform Logs for the repository 'my-repo' in us-west1 for INFO level and above:
$ {command} --project=my-project --location=us-west1 --repository=my-repo --severity=INFO
""",
}
@staticmethod
def Args(parser):
"""Set up arguments for this command.
Args:
parser: An argparse.ArgumentPaser.
"""
flags.GetPlainRepoFlag().AddToParser(parser)
flags.GetPlainLocationFlag().AddToParser(parser)
flags.GetSeverityFlag().AddToParser(parser)
def Run(self, args):
"""Run the enable command."""
client = apis.GetClientInstance('artifactregistry', self.api_version)
messages = client.MESSAGES_MODULE
platform_logs_config = messages.PlatformLogsConfig(
loggingState=messages.PlatformLogsConfig.LoggingStateValueValuesEnum.ENABLED
)
if args.IsSpecified('severity'):
platform_logs_config.severityLevel = (
messages.PlatformLogsConfig.SeverityLevelValueValuesEnum(
args.severity
)
)
response = platformlogs_util.UpdatePlatformLogsConfig(
args, client, messages, platform_logs_config
)
severity_msg = ' for all severity levels'
if args.IsSpecified('severity'):
severity_msg = ' for severity {} and above'.format(args.severity)
log.status.Print('Enabled Platform Logs for [{}]{}.'.format(
response.name, severity_msg))
return response