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,27 @@
# -*- 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 VMware Engine subnets CLI."""
from __future__ import absolute_import
from __future__ import division
from __future__ import unicode_literals
from googlecloudsdk.calliope import base
@base.ReleaseTracks(base.ReleaseTrack.GA)
class Subnets(base.Group):
"""Manage vmware subnets in Google Cloud VMware Engine."""
category = base.COMPUTE_CATEGORY

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.
"""'vmware private-clouds subnets describe' command."""
from __future__ import absolute_import
from __future__ import division
from __future__ import unicode_literals
from googlecloudsdk.api_lib.vmware.private_clouds.subnets import SubnetsClient
from googlecloudsdk.calliope import base
from googlecloudsdk.command_lib.vmware import flags
DETAILED_HELP = {
'DESCRIPTION':
"""
Describe a Subnet by its resource name. It contains details of the subnet, such as ip_cidr_range, gateway_ip, state, and type.
""",
'EXAMPLES':
"""
To get the information about a subnet resource called `my-subnet`, that belongs to the private cloud `my-private-cloud` in project `my-project` and zone `us-west1-a`, run:
$ {command} my-subnet --private-cloud=my-private-cloud --location=us-west1-a --project=my-project
Or:
$ {command} my-subnet --private-cloud=my-private-cloud
In the second example, the project and location are taken from gcloud properties `core/project` and `compute/zone`, respectively.
"""
}
@base.ReleaseTracks(base.ReleaseTrack.GA)
class Describe(base.DescribeCommand):
"""Describe a subnet in a VMware Engine private cloud."""
detailed_help = DETAILED_HELP
@staticmethod
def Args(parser):
"""Register flags for this command."""
flags.AddSubnetArgToParser(parser)
def Run(self, args):
subnet = args.CONCEPTS.subnet.Parse()
client = SubnetsClient()
return client.Get(subnet)

View File

@@ -0,0 +1,83 @@
# -*- 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.
"""'vmware private-clouds subnets list' command."""
from __future__ import absolute_import
from __future__ import division
from __future__ import unicode_literals
from googlecloudsdk.api_lib.vmware.private_clouds.subnets import SubnetsClient
from googlecloudsdk.calliope import base
from googlecloudsdk.command_lib.vmware import flags
DETAILED_HELP = {
'DESCRIPTION':
"""
List subnets in a VMware Engine private cloud.
""",
'EXAMPLES':
"""
To list subnets that belong to the private cloud `my-privatecloud` in project `my-project` and zone `us-east2-b`, run:
$ {command} --private-cloud=my-privatecloud --location=us-east2-b --project=my-project
Or:
$ {command} --private-cloud=my-privatecloud
In the above example, the project and the location are taken from gcloud properties `core/project` and `compute/zone`, respectively.
To list subnets that belong to all the private clouds in project `my-project` and zone `us-east2-b`, run:
$ {command} --private-cloud=- --location=us-east2-b --project=my-project
Or:
$ {command} --private-cloud=-
In the above example, the project and the location are taken from gcloud properties `core/project` and `compute/zone`, respectively.
To list subnets for all private clouds in all locations in project `my-project`, run:
$ {command} --private-cloud=- --location=- --project=my-project
Or:
$ {command} --private-cloud=- --location=-
In the last example, the project is taken from gcloud properties `core/project`.
""",
}
@base.ReleaseTracks(base.ReleaseTrack.GA)
class List(base.ListCommand):
"""List subnets in a VMware Engine private cloud."""
detailed_help = DETAILED_HELP
@staticmethod
def Args(parser):
"""Register flags for this command."""
flags.AddPrivatecloudArgToParser(parser)
parser.display_info.AddFormat('table(name.segment(-1):label=NAME,'
'name.segment(-5):label=LOCATION,'
'name.segment(-3):label=PRIVATE_CLOUD,'
'type,gatewayIp,ipCidrRange,state,vlanId)')
def Run(self, args):
privatecloud = args.CONCEPTS.private_cloud.Parse()
client = SubnetsClient()
return client.List(privatecloud)

View File

@@ -0,0 +1,82 @@
# -*- 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.
"""'vmware private-clouds subnets update' command."""
from __future__ import absolute_import
from __future__ import division
from __future__ import unicode_literals
from googlecloudsdk.api_lib.vmware.private_clouds.subnets import SubnetsClient
from googlecloudsdk.calliope import base
from googlecloudsdk.command_lib.vmware import flags
from googlecloudsdk.core import log
DETAILED_HELP = {
'DESCRIPTION':
"""
Update a Subnet. Only ip-cidr-range can be updated. This is a synchronous command and doesn't support `--async` and `--no-async` flags.
""",
'EXAMPLES':
"""
To update a subnet named `my-subnet`, that belongs to the private cloud `my-private-cloud` in project `my-project` and zone `us-west1-a` by changing its ip-cidr-range to `10.0.0.0/24`, run:
$ {command} my-subnet --private-cloud=my-private-cloud --location=us-west1 --project=my-project --ip-cidr-range=10.0.0.0/24
Or:
$ {command} my-subnet --private-cloud=my-private-cloud --ip-cidr-range=10.0.0.0/24
In the second example, the project and location are taken from gcloud properties `core/project` and `compute/zone`, respectively.
"""
}
@base.ReleaseTracks(base.ReleaseTrack.GA)
class Update(base.UpdateCommand):
"""Update a subnet."""
detailed_help = DETAILED_HELP
@staticmethod
def Args(parser):
"""Register flags for this command."""
flags.AddSubnetArgToParser(parser)
parser.display_info.AddFormat('yaml')
parser.add_argument(
'--ip-cidr-range',
required=True,
help="""\
Updated IP CIDR range for this subnet.
""")
def Run(self, args):
subnet = args.CONCEPTS.subnet.Parse()
client = SubnetsClient()
operation = client.Update(subnet, args.ip_cidr_range)
# Since this is a passthrough API, it doesn't return a standard operation.
# It returns an operation with only two fields: `done` and `response`. If
# `operation.done == true` we extract the resource from `operation.response`
# field otherwise we wait for the operation to be completed.
if operation.done:
resource = client.GetResponse(operation)
else:
resource = client.WaitForOperation(
operation_ref=client.GetOperationRef(operation),
message='waiting for subnet [{}] to be updated'.format(
subnet.RelativeName()
),
)
log.UpdatedResource(subnet.RelativeName(), kind='subnet')
return resource