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 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.
"""Manage Cloud Workstations configuration resources."""
from __future__ import absolute_import
from __future__ import division
from __future__ import unicode_literals
from googlecloudsdk.calliope import base
class Configs(base.Group):
"""Manage Cloud Workstations configuration resources."""
category = base.TOOLS_CATEGORY
def Filter(self, context, args):
del context, args

View File

@@ -0,0 +1,114 @@
# -*- 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 for creating Workstation configs."""
from __future__ import absolute_import
from __future__ import division
from __future__ import unicode_literals
from googlecloudsdk.api_lib.workstations import configs
from googlecloudsdk.calliope import base
from googlecloudsdk.command_lib.workstations import flags as workstations_flags
@base.DefaultUniverseOnly
@base.ReleaseTracks(
base.ReleaseTrack.GA, base.ReleaseTrack.BETA, base.ReleaseTrack.ALPHA
)
class Create(base.CreateCommand):
"""Create a workstation configuration.
Create a workstation configuration.
## EXAMPLES
To create a configuration with the 'e2-standard-8' machine type and a
IntelliJ image, run:
$ {command} CONFIG --machine-type=e2-standard-8
--container-predefined-image=intellij
To create a configuration with a Shielded VM instance that enables Secure
Boot, virtual trusted platform module (vTPM) and integrity monitoring, run:
$ {command} CONFIG --machine-type=e2-standard-4 --shielded-secure-boot
--shielded-vtpm --shielded-integrity-monitoring
To create a configuration with a non-default persistent disk containing 10GB
of PD SSD storage, run:
$ {command} CONFIG --machine-type=e2-standard-4 --pd-disk-type=pd-ssd
--pd-disk-size=10
"""
@classmethod
def Args(cls, parser):
workstations_flags.AddAcceleratorFields(parser)
workstations_flags.AddAllowedPortsFlag(parser)
workstations_flags.AddAsyncFlag(parser)
workstations_flags.AddBootDiskSize(parser)
workstations_flags.AddConfigResourceArg(parser)
workstations_flags.AddContainerArgsField(parser)
workstations_flags.AddContainerCommandField(parser)
workstations_flags.AddContainerEnvField(parser)
workstations_flags.AddContainerImageField(parser)
workstations_flags.AddContainerRunAsUserField(parser)
workstations_flags.AddContainerWorkingDirField(parser)
workstations_flags.AddDeprecatedDisableSSHToVM(parser)
workstations_flags.AddDisablePublicIpAddresses(parser)
workstations_flags.AddDisableTcpConnections(parser)
workstations_flags.AddEnableAuditAgent(parser)
workstations_flags.AddEnableConfidentialCompute(parser)
workstations_flags.AddEnableNestedVirtualization(parser)
workstations_flags.AddEnableSSHToVM(parser, True)
workstations_flags.AddEncryptionKeyFields(parser)
workstations_flags.AddEphemeralDirectory(parser)
workstations_flags.AddGrantWorkstationAdminRoleOnCreate(parser)
workstations_flags.AddIdleTimeoutFlag(parser)
workstations_flags.AddLabelsField(parser)
workstations_flags.AddMachineTypeFlag(parser)
workstations_flags.AddMaxUsableWorkstationsCount(parser)
workstations_flags.AddNetworkTags(parser)
workstations_flags.AddPoolSize(parser)
workstations_flags.AddReplicaZones(parser)
workstations_flags.AddRunningTimeoutFlag(parser)
workstations_flags.AddServiceAccountFlag(parser)
workstations_flags.AddServiceAccountScopes(parser)
workstations_flags.AddShieldedIntegrityMonitoring(parser)
workstations_flags.AddShieldedSecureBoot(parser)
workstations_flags.AddShieldedVtpm(parser)
workstations_flags.AddStartupScriptUri(parser)
workstations_flags.AddVmTags(parser)
if cls.ReleaseTrack() == base.ReleaseTrack.GA:
workstations_flags.AddNoPersistentStorageOrPd(parser)
else:
workstations_flags.AddNoPersistentStorageOrPdOrDisk(parser)
if cls.ReleaseTrack() != base.ReleaseTrack.GA:
workstations_flags.AddAllowUnauthenticatedCorsPreflightRequestsFlag(
parser
)
workstations_flags.AddBoostConfigs(parser)
workstations_flags.AddDisableLocalhostReplacementFlag(parser)
workstations_flags.AddReservationAffinity(parser)
workstations_flags.AddInstanceMetadata(parser)
def Collection(self):
return (
'workstations.projects.locations.workstationClusters.workstationConfigs'
)
def Run(self, args):
client = configs.Configs(self.ReleaseTrack())
response = client.Create(args)
return response

View File

@@ -0,0 +1,29 @@
- release_tracks: [GA, BETA, ALPHA]
help_text:
brief: |
Delete a workstation configuration.
description: |
Delete a workstation configuration.
examples: |
To delete a configuration, run:
$ {command} WORKSTATION
arguments:
resource:
spec: !REF googlecloudsdk.command_lib.workstations.resources:config
help_text: |
The name of the configuration to delete.
request:
GA:
api_version: v1
BETA:
api_version: v1beta
ALPHA:
api_version: v1beta
collection: workstations.projects.locations.workstationClusters.workstationConfigs
async:
collection: workstations.projects.locations.operations

View File

@@ -0,0 +1,29 @@
- release_tracks: [GA, BETA, ALPHA]
help_text:
brief: |
Describe a config.
description: |
Describe a config.
examples: |
To describe a config, run:
$ {command} CONFIG
arguments:
resource:
spec: !REF googlecloudsdk.command_lib.workstations.resources:config
help_text: |
The name of the config to display.
request:
GA:
api_version: v1
BETA:
api_version: v1beta
ALPHA:
api_version: v1beta
collection: workstations.projects.locations.workstationClusters.workstationConfigs
output:
format: json

View File

@@ -0,0 +1,30 @@
- release_tracks: [GA, BETA, ALPHA]
help_text:
brief: Get the IAM policy for a configuration..
description: |
*{command}* displays the IAM policy associated with a given configuration. If formatted as
JSON, the output can be edited and used as a policy file for set-iam-policy. The output
includes an "etag" field identifying the version emitted and allowing detection of concurrent
policy updates; see
$ {parent} set-iam-policy for additional details.
examples: |
To get the IAM policy for a given configuration, run:
$ {command} CONFIG
arguments:
resource:
spec: !REF googlecloudsdk.command_lib.workstations.resources:config
help_text: |
The configuration for which to display the IAM policy.
request:
GA:
api_version: v1
BETA:
api_version: v1beta
ALPHA:
api_version: v1beta
collection: workstations.projects.locations.workstationClusters.workstationConfigs

View File

@@ -0,0 +1,37 @@
- release_tracks: [GA, BETA, ALPHA]
help_text:
brief: |
List workstation configurations.
description: |
List all workstation configurations under the specified cluster.
examples: |
To list workstation configurations, run:
$ {command}
arguments:
resource:
spec: !REF googlecloudsdk.command_lib.workstations.resources:cluster_with_global_fallthrough
help_text: |
The cluster of the configurations to display.
request:
GA:
api_version: v1
BETA:
api_version: v1beta
ALPHA:
api_version: v1beta
collection: workstations.projects.locations.workstationClusters.workstationConfigs
output:
format: |
table(
name.basename():sort=1,
name.scope(workstationClusters).segment(0):label='CLUSTER',
name.scope(locations).segment(0):label='REGION',
createTime.date(),
host.gceInstance.machine_type:label='MACHINE TYPE',
container.image:label='IMAGE'
)

View File

@@ -0,0 +1,30 @@
- release_tracks: [GA, BETA, ALPHA]
help_text:
brief: Set the IAM policy for a configuration.
description: |
Sets the IAM policy for the given configuration as defined in a JSON or YAML file.
examples: |
The following command will read an IAM policy defined in a JSON file 'policy.json' and set it
for the given configuration:
$ {command} CONFIG policy.json
See https://cloud.google.com/iam/docs/managing-policies for details of the
policy file format and contents.
arguments:
resource:
spec: !REF googlecloudsdk.command_lib.workstations.resources:config
help_text: |
The configuration for which to display the IAM policy.
request:
GA:
api_version: v1
BETA:
api_version: v1beta
ALPHA:
api_version: v1beta
collection: workstations.projects.locations.workstationClusters.workstationConfigs

View File

@@ -0,0 +1,109 @@
# -*- 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 for updating Workstation configs."""
from __future__ import absolute_import
from __future__ import division
from __future__ import unicode_literals
from googlecloudsdk.api_lib.workstations import configs
from googlecloudsdk.calliope import base
from googlecloudsdk.command_lib.workstations import flags as workstations_flags
@base.DefaultUniverseOnly
@base.ReleaseTracks(
base.ReleaseTrack.GA, base.ReleaseTrack.BETA, base.ReleaseTrack.ALPHA
)
class Update(base.UpdateCommand):
"""Updates a workstation configuration.
Updates a workstation configuration.
## EXAMPLES
To update a configuration with the 'e2-standard-8' machine type and a
IntelliJ image, run:
$ {command} CONFIG --machine-type=e2-standard-8
--container-predefined-image=intellij
To update a configuration to disable Secure Boot, virtual trusted platform
module (vTPM) and integrity monitoring, run:
$ {command} CONFIG --no-shielded-secure-boot --no-shielded-vtpm
--no-shielded-integrity-monitoring
"""
@classmethod
def Args(cls, parser):
workstations_flags.AddAcceleratorFields(parser)
workstations_flags.AddAllowedPortsFlag(parser)
workstations_flags.AddAsyncFlag(parser)
workstations_flags.AddBootDiskSize(parser, use_default=False)
workstations_flags.AddConfigResourceArg(parser)
workstations_flags.AddContainerArgsField(parser)
workstations_flags.AddContainerCommandField(parser)
workstations_flags.AddContainerEnvField(parser)
workstations_flags.AddContainerImageField(parser, use_default=False)
workstations_flags.AddContainerRunAsUserField(parser)
workstations_flags.AddContainerWorkingDirField(parser)
workstations_flags.AddDisablePublicIpAddresses(parser, use_default=False)
workstations_flags.AddDisableSSHToVM(parser)
workstations_flags.AddEnableAuditAgent(parser, use_default=False)
workstations_flags.AddEnableConfidentialCompute(parser, use_default=False)
workstations_flags.AddEnableNestedVirtualization(parser, use_default=False)
workstations_flags.AddEnableTcpConnections(parser)
workstations_flags.AddGrantWorkstationAdminRoleOnCreate(
parser, use_default=False
)
workstations_flags.AddIdleTimeoutFlag(parser, use_default=False)
workstations_flags.AddLabelsField(parser)
workstations_flags.AddMachineTypeFlag(parser, use_default=False)
workstations_flags.AddMaxUsableWorkstationsCount(parser)
workstations_flags.AddNetworkTags(parser)
workstations_flags.AddPoolSize(parser, use_default=False)
workstations_flags.AddRunningTimeoutFlag(parser, use_default=False)
workstations_flags.AddServiceAccountFlag(parser)
workstations_flags.AddServiceAccountScopes(parser)
workstations_flags.AddShieldedSecureBoot(parser, use_default=False)
workstations_flags.AddShieldedIntegrityMonitoring(parser, use_default=False)
workstations_flags.AddShieldedVtpm(parser, use_default=False)
workstations_flags.AddStartupScriptUri(parser)
workstations_flags.AddVmTags(parser)
if cls.ReleaseTrack() != base.ReleaseTrack.GA:
workstations_flags.AddPersistentDirectoriesOrHyperdisks(
parser, use_default=False
)
else:
workstations_flags.AddPersistentDirectories(parser, use_default=False)
if cls.ReleaseTrack() != base.ReleaseTrack.GA:
workstations_flags.AddDisallowUnauthenticatedCorsPreflightRequestsToggleFlag(
parser
)
workstations_flags.AddBoostConfigs(parser)
workstations_flags.AddDisableLocalhostReplacementToggleFlag(parser)
workstations_flags.AddReservationAffinity(parser)
workstations_flags.AddInstanceMetadata(parser)
def Collection(self):
return (
'workstations.projects.locations.workstationClusters.workstationConfigs'
)
def Run(self, args):
client = configs.Configs(self.ReleaseTrack())
response = client.Update(args)
return response