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,39 @@
# -*- 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 Distributed Cloud Edge Network CLI."""
from __future__ import absolute_import
from __future__ import division
from __future__ import unicode_literals
from googlecloudsdk.calliope import base
@base.ReleaseTracks(base.ReleaseTrack.ALPHA)
class EdgeNetworkAlpha(base.Group):
"""Manage Distributed Cloud Edge Network resources."""
category = base.COMPUTE_CATEGORY
def Filter(self, context, args):
del context, args
@base.ReleaseTracks(base.ReleaseTrack.GA)
class EdgeNetwork(base.Group):
"""Manage Distributed Cloud Edge Network resources."""
category = base.COMPUTE_CATEGORY
def Filter(self, context, args):
del context, args

View File

@@ -0,0 +1,26 @@
# -*- 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 interconnect resource."""
from __future__ import absolute_import
from __future__ import division
from __future__ import unicode_literals
from googlecloudsdk.calliope import base
@base.ReleaseTracks(base.ReleaseTrack.ALPHA, base.ReleaseTrack.GA)
class Interconnects(base.Group):
"""Manage Distributed Cloud Edge Network interconnects."""

View File

@@ -0,0 +1,26 @@
# -*- 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 attachment resource."""
from __future__ import absolute_import
from __future__ import division
from __future__ import unicode_literals
from googlecloudsdk.calliope import base
@base.ReleaseTracks(base.ReleaseTrack.ALPHA, base.ReleaseTrack.GA)
class Attachments(base.Group):
"""Manage Distributed Cloud Edge Network interconnect attachments."""

View File

@@ -0,0 +1,26 @@
# -*- 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 attachment resource(dedicated)."""
from __future__ import absolute_import
from __future__ import division
from __future__ import unicode_literals
from googlecloudsdk.calliope import base
@base.ReleaseTracks(base.ReleaseTrack.ALPHA, base.ReleaseTrack.GA)
class Attachments(base.Group):
"""Manage Distributed Cloud Edge Network dedicated interconnect attachments."""

View File

@@ -0,0 +1,60 @@
- release_tracks: [ALPHA, GA]
help_text:
brief: Create a Distributed Cloud Edge Network interconnect attachment.
description: |
Create a new dedicated Distributed Cloud Edge Network interconnect attachment.
examples: |
To create a dedicated interconnect attachment called 'my-attachment' in edge zone 'us-central1-edge-den1', run:
$ {command} my-attachment --location=us-central1 --zone=us-central1-edge-den1 --interconnect=INTERCONNECT-LINK1 --network=my-edge-network --vlan-id=200 --mtu=1500
request:
collection: edgenetwork.projects.locations.zones.interconnectAttachments
ALPHA:
api_version: v1alpha1
GA:
api_version: v1
modify_request_hooks:
- googlecloudsdk.command_lib.edge_cloud.networking.resources:SetResourcesPathForAttachment
arguments:
resource:
help_text: Distributed Cloud Edge Network interconnectAttachment to create.
# The following should point to the resource argument definition under
# your surface's command_lib directory.:
spec: !REF googlecloudsdk.command_lib.edge_cloud.networking.resources:attachment
params:
- arg_name: interconnect
api_field: interconnectAttachment.interconnect
required: true
help_text: |
The underlying interconnect object that this attachment's traffic will traverse through.
- arg_name: network
api_field: interconnectAttachment.network
help_text: |
The network to use for dynamic routing.
- arg_name: mtu
api_field: interconnectAttachment.mtu
type: int
default: 1500
help_text: |
Maximum transmission unit (MTU) is the size of the largest
IP packet that can be transmitted on this attachment. Default
value is 1500 bytes, and the valid values are 1500 and 9000.
- arg_name: vlan-id
api_field: interconnectAttachment.vlanId
default: 0
type: int
help_text: |
The ID of the vlan to tag the subnetwork. Default value is 0.
- arg_name: description
api_field: interconnectAttachment.description
help_text: |
An optional, textual description for the interconnect attachment.
labels:
api_field: interconnectAttachment.labels
async:
collection: edgenetwork.projects.locations.operations

View File

@@ -0,0 +1,27 @@
- release_tracks: [ALPHA, GA]
help_text:
brief: Delete a Distributed Cloud Edge Network interconnect attachment.
description: |
Delete a Distributed Cloud Edge Network interconnect attachment.
examples: |
To delete an interconnect attachment called 'my-attachment' in edge zone 'us-central1-edge-den1', run:
$ {command} my-attachment --location=us-central1 --zone=us-central1-edge-den1
request:
collection: edgenetwork.projects.locations.zones.interconnectAttachments
ALPHA:
api_version: v1alpha1
GA:
api_version: v1
arguments:
resource:
help_text: Distributed Cloud Edge Network interconnectAttachment to delete.
# The following should point to the resource argument definition under your
# surface's command_lib directory.:
spec: !REF googlecloudsdk.command_lib.edge_cloud.networking.resources:attachment
async:
collection: edgenetwork.projects.locations.operations

View File

@@ -0,0 +1,41 @@
release_tracks: [ALPHA, GA]
help_text:
brief: Show details about a Distributed Cloud Edge Network interconnect attachment.
description: |
Show details about a Distributed Cloud Edge Network interconnect attachment.
examples: |
To show details about an interconnect attachment called 'my-attachment' in edge zone 'us-central1-edge-den1', run:
$ {command} my-attachment --location=us-central1 --zone=us-central1-edge-den1
request:
collection: edgenetwork.projects.locations.zones.interconnectAttachments
ALPHA:
api_version: v1alpha1
GA:
api_version: v1
arguments:
resource:
help_text: The interconnect attachment you want to describe.
# The following should point to the resource argument definition under your
# surface's command_lib directory.:
spec: !REF googlecloudsdk.command_lib.edge_cloud.networking.resources:attachment
output:
GA:
format: |
yaml(
createTime,
description,
interconnect,
labels,
mtu,
name,
network,
router,
state,
updateTime,
vlanId
)

View File

@@ -0,0 +1,50 @@
- release_tracks: [ALPHA, GA]
help_text:
brief: List Distributed Cloud Edge Network interconnect attachments.
description: |
List Distributed Cloud Edge Network interconnect attachments.
examples: |
To list the interconnect attachments in edge zone 'us-central1-edge-den1', run:
$ {command} --location=us-central1 --zone=us-central1-edge-den1
request:
collection: edgenetwork.projects.locations.zones.interconnectAttachments
ALPHA:
api_version: v1alpha1
GA:
api_version: v1
response:
id_field: name
arguments:
resource:
help_text: Parent Distributed Cloud Edge Network zone to list all contained Distributed Cloud Edge Network interconnect attachments.
# The following should point to the parent resource argument definition
# under your surface's command_lib directory.:
spec: !REF googlecloudsdk.command_lib.edge_cloud.networking.resources:zone
output:
GA:
format: |
table(
name.basename():label=NAME,
mtu:label=MTU,
vlanId:label=VLANID,
interconnect.basename():label=INTERCONNECT,
network.basename():label=NETWORK,
state.sub("STATE_", ""):label=STATE
)
ALPHA:
format: |
table(
name.basename():label=NAME,
mtu:label=MTU,
vlanId:label=VLANID,
interconnect.basename():label=INTERCONNECT,
peeringType.sub("REMOTE_PEERING_NETWORK_TYPE_", ""):label=REMOTEPEERINGTYPE,
network.basename():label=NETWORK,
state.sub("STATE_", ""):label=STATE
)

View File

@@ -0,0 +1,37 @@
release_tracks: [ALPHA, GA]
help_text:
brief: Show details about the Distributed Cloud Edge Network interconnect.
description: Show details about the Distributed Cloud Edge Network interconnect.
examples: |
To show details about an interconnect called 'my-interconnect1' in edge zone 'us-central1-edge-den1', run:
$ {command} my-interconnect1 --location=us-central1 --zone=us-central1-edge-den1
request:
collection: edgenetwork.projects.locations.zones.interconnects
ALPHA:
api_version: v1alpha1
GA:
api_version: v1
arguments:
resource:
help_text: The interconnect you want to describe.
# The following should point to the resource argument definition under your
# surface's command_lib directory.:
spec: !REF googlecloudsdk.command_lib.edge_cloud.networking.resources:interconnect
output:
GA:
format: |
yaml(
createTime,
description,
deviceCloudResourceName,
interconnectType,
labels,
name,
physicalPorts,
updateTime
)

View File

@@ -0,0 +1,56 @@
# -*- 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 get the diagnostics of a Distributed Cloud Edge Network interconnect.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import unicode_literals
from googlecloudsdk.api_lib.edge_cloud.networking.interconnects import interconnects
from googlecloudsdk.calliope import base
from googlecloudsdk.command_lib.edge_cloud.networking import resource_args
DESCRIPTION = (
'Get the diagnostics of a specified Distributed Cloud Edge Network '
'interconnect.')
EXAMPLES = """\
To get the diagnostics of the Distributed Cloud Edge Network interconnect
'my-interconnect' in edge zone 'us-central1-edge-den1' , run:
$ {command} my-interconnect --location=us-central1 --zone=us-central1-edge-den1
"""
@base.ReleaseTracks(base.ReleaseTrack.ALPHA, base.ReleaseTrack.GA)
class GetStatus(base.Command):
"""Get the diagnostics of a specified Distributed Cloud Edge Network interconnect.
*{command}* is used to get the diagnostics of a Distributed Cloud Edge Network
interconnect.
"""
detailed_help = {'DESCRIPTION': DESCRIPTION, 'EXAMPLES': EXAMPLES}
@staticmethod
def Args(parser):
resource_args.AddInterconnectResourceArg(parser, 'to get diagnostics', True)
def Run(self, args):
interconnects_client = interconnects.InterconnectsClient(
self.ReleaseTrack())
interconnect_ref = args.CONCEPTS.interconnect.Parse()
return interconnects_client.GetStatus(interconnect_ref)

View File

@@ -0,0 +1,46 @@
- release_tracks: [ALPHA, GA]
help_text:
brief: List Distributed Cloud Edge Network interconnects.
description: |
List Distributed Cloud Edge Network interconnects.
examples: |
To list the Distributed Cloud Edge Network interconnects in edge zone 'us-central1-edge-den1', run:
$ {command} --location=us-central1 --zone=us-central1-edge-den1
request:
collection: edgenetwork.projects.locations.zones.interconnects
ALPHA:
api_version: v1alpha1
GA:
api_version: v1
response:
id_field: name
arguments:
resource:
help_text: Parent Distributed Cloud Edge Network zone to list all contained Distributed Cloud Edge Network interconnects.
# The following should point to the parent resource argument definition
# under your surface's command_lib directory.:
spec: !REF googlecloudsdk.command_lib.edge_cloud.networking.resources:zone
output:
GA:
format: |
table(
name.basename():label=NAME,
uuid:label=UUID,
deviceCloudResourceName:label=DEVICECLOUDRESOURCENAME,
physicalPorts.list():label=PHYSICALPORTS
)
ALPHA:
format: |
table(
name.basename():label=NAME,
uuid:label=UUID,
deviceCloudResourceName:label=DEVICECLOUDRESOURCENAME,
physicalPorts.list():label=PHYSICALPORTS,
remotePeeringNetworkType.sub("REMOTE_PEERING_NETWORK_TYPE_", ""):label=REMOTEPEERINGTYPE
)

View File

@@ -0,0 +1,26 @@
# -*- 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 Distributed Cloud Edge Network network resource."""
from __future__ import absolute_import
from __future__ import division
from __future__ import unicode_literals
from googlecloudsdk.calliope import base
@base.ReleaseTracks(base.ReleaseTrack.ALPHA, base.ReleaseTrack.GA)
class Networks(base.Group):
"""Manage Distributed Cloud Edge Network networks."""

View File

@@ -0,0 +1,42 @@
- release_tracks: [ALPHA, GA]
help_text:
brief: Create a Distributed Cloud Edge Network network.
description: |
Create a new Distributed Cloud Edge Network network resource.
examples: |
To create a network called 'my-network' with MTU value of 9000 bytes in edge zone 'us-central1-edge-den1',
run:
$ {command} my-network --location=us-central1 --zone=us-central1-edge-den1 --mtu=9000
request:
collection: edgenetwork.projects.locations.zones.networks
ALPHA:
api_version: v1alpha1
GA:
api_version: v1
arguments:
resource:
help_text: Distributed Cloud Edge Network network to create.
# The following should point to the resource argument definition under
# your surface's command_lib directory.:
spec: !REF googlecloudsdk.command_lib.edge_cloud.networking.resources:network
params:
- arg_name: description
api_field: network.description
help_text: |
An optional, textual description for the network.
- arg_name: mtu
api_field: network.mtu
help_text: |
Maximum transmission unit (MTU) is the size of the largest
IP packet that can be transmitted on this network. Default value
is 1500 bytes, and the valid values are 1500 and 9000.
labels:
api_field: network.labels
async:
collection: edgenetwork.projects.locations.operations

View File

@@ -0,0 +1,27 @@
- release_tracks: [ALPHA, GA]
help_text:
brief: Delete a Distributed Cloud Edge Network network.
description: |
Delete a Distributed Cloud Edge Network network.
examples: |
To delete a Distributed Cloud Edge Network network called 'my-network' in edge zone 'us-central1-edge-den1', run:
$ {command} my-network --location=us-central1 --zone=us-central1-edge-den1
request:
collection: edgenetwork.projects.locations.zones.networks
ALPHA:
api_version: v1alpha1
GA:
api_version: v1
arguments:
resource:
help_text: Distributed Cloud Edge Network network to delete.
# The following should point to the resource argument definition under your
# surface's command_lib directory.:
spec: !REF googlecloudsdk.command_lib.edge_cloud.networking.resources:network
async:
collection: edgenetwork.projects.locations.operations

View File

@@ -0,0 +1,23 @@
release_tracks: [ALPHA, GA]
help_text:
brief: Show details about the Distributed Cloud Edge Network network.
description: Show details about the Distributed Cloud Edge Network network.
examples: |
To show details about a network called 'my-network' in edge zone 'us-central1-edge-den1', run:
$ {command} my-network --location=us-central1 --zone=us-central1-edge-den1
request:
collection: edgenetwork.projects.locations.zones.networks
ALPHA:
api_version: v1alpha1
GA:
api_version: v1
arguments:
resource:
help_text: The Distributed Cloud Edge Network network you want to describe.
# The following should point to the resource argument definition under your
# surface's command_lib directory.:
spec: !REF googlecloudsdk.command_lib.edge_cloud.networking.resources:network

View File

@@ -0,0 +1,53 @@
# -*- 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 get the status of a Distributed Cloud Edge Network network."""
from __future__ import absolute_import
from __future__ import division
from __future__ import unicode_literals
from googlecloudsdk.api_lib.edge_cloud.networking.networks import networks
from googlecloudsdk.calliope import base
from googlecloudsdk.command_lib.edge_cloud.networking import resource_args
DESCRIPTION = (
'Get the status of a specified Distributed Cloud Edge Network network.')
EXAMPLES = """\
To get the status of the Distributed Cloud Edge Network network
'my-network' in edge zone 'us-central1-edge-den1' , run:
$ {command} my-network --location=us-central1 --zone=us-central1-edge-den1
"""
@base.ReleaseTracks(base.ReleaseTrack.ALPHA, base.ReleaseTrack.GA)
class GetStatus(base.Command):
"""Get the status of a specified Distributed Cloud Edge Network network.
*{command}* is used to get the status of a Distributed Cloud Edge Network
network.
"""
detailed_help = {'DESCRIPTION': DESCRIPTION, 'EXAMPLES': EXAMPLES}
@staticmethod
def Args(parser):
resource_args.AddNetworkResourceArg(parser, 'to get status', True)
def Run(self, args):
networks_client = networks.NetworksClient(self.ReleaseTrack())
network_ref = args.CONCEPTS.network.Parse()
return networks_client.GetStatus(network_ref)

View File

@@ -0,0 +1,37 @@
- release_tracks: [ALPHA, GA]
help_text:
brief: List Distributed Cloud Edge Network networks.
description: |
List Distributed Cloud Edge Network networks.
examples: |
To list the Distributed Cloud Edge Network networks in edge zone 'us-central1-edge-den1', run:
$ {command} --location=us-central1 --zone=us-central1-edge-den1
request:
collection: edgenetwork.projects.locations.zones.networks
ALPHA:
api_version: v1alpha1
GA:
api_version: v1
response:
id_field: name
arguments:
resource:
help_text: Parent Distributed Cloud Edge Network zone to list all contained Distributed Cloud Edge Network networks.
# The following should point to the parent resource argument definition
# under your surface's command_lib directory.:
spec: !REF googlecloudsdk.command_lib.edge_cloud.networking.resources:zone
output:
format: |
table(
name.basename():label=NAME,
mtu:label=MTU,
description:label=DESCRIPTION,
createTime:label=CREATETIME,
updateTime:label=UPDATETIME
)

View File

@@ -0,0 +1,26 @@
# -*- 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 Distributed Cloud Edge Network operations."""
from __future__ import absolute_import
from __future__ import division
from __future__ import unicode_literals
from googlecloudsdk.calliope import base
@base.ReleaseTracks(base.ReleaseTrack.ALPHA, base.ReleaseTrack.GA)
class Operations(base.Group):
"""Command group for working with Distributed Cloud Edge Network operations."""

View File

@@ -0,0 +1,25 @@
- release_tracks: [ALPHA, GA]
help_text:
brief: Get description of a long-running edge network operation.
description: |
Get information about a long-running edge network operation.
examples: |-
To get information about a long-running operation with name 'projects/my-project/locations/us-east1/operations/123', run the following command:
$ {command} projects/my-project/locations/us-east1/operations/123
request:
collection: edgenetwork.projects.locations.operations
ALPHA:
api_version: v1alpha1
GA:
api_version: v1
arguments:
resource:
help_text: The ID of the operation to describe.
spec: !REF googlecloudsdk.command_lib.edge_cloud.networking.resources:operation
output:
format: json

View File

@@ -0,0 +1,31 @@
- release_tracks: [ALPHA, GA]
help_text:
brief: Poll long-running edge network operation until it completes.
description: |
Poll a long-running edge network operation until it completes. When
the operation is complete, this command will display the results of the
analysis.
examples: |
To poll a long-running edge network operation named 'projects/my-project/locations/us-east1/operations/123' until it completes, run the following:
$ {command} projects/my-project/locations/us-east1/operations/123
request:
collection: edgenetwork.projects.locations.operations
ALPHA:
api_version: v1alpha1
GA:
api_version: v1
arguments:
resource:
help_text: ID for the operation to poll until complete.
spec: !REF googlecloudsdk.command_lib.edge_cloud.networking.resources:operation
async:
collection: edgenetwork.projects.locations.operations
result_attribute: response
output:
format: json

View File

@@ -0,0 +1,26 @@
# -*- 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 Distributed Cloud Edge Network routers resource."""
from __future__ import absolute_import
from __future__ import division
from __future__ import unicode_literals
from googlecloudsdk.calliope import base
@base.ReleaseTracks(base.ReleaseTrack.ALPHA, base.ReleaseTrack.GA)
class Routers(base.Group):
"""Manage Distributed Cloud Edge Network routers."""

View File

@@ -0,0 +1,121 @@
# -*- 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 add a BGP peer to a Distributed Cloud Edge Network router."""
from __future__ import absolute_import
from __future__ import division
from __future__ import unicode_literals
from googlecloudsdk.api_lib.edge_cloud.networking.routers import routers
from googlecloudsdk.calliope import base
from googlecloudsdk.command_lib.edge_cloud.networking import resource_args
from googlecloudsdk.command_lib.edge_cloud.networking.routers import flags as routers_flags
from googlecloudsdk.core import log
DESCRIPTION = ('Create a BGP peer to a Distributed Cloud Edge Network router')
EXAMPLES_GA = """\
To create and add a BGP peer for the Distributed Cloud Edge Network router
'my-router' in edge zone 'us-central1-edge-den1' , run:
$ {command} my-router --interface=my-int-r1 --peer-asn=33333 --peer-name=peer1 --peer-ipv4-range=208.117.254.232/31 --location=us-central1 --zone=us-central1-edge-den1
"""
EXAMPLES_ALPHA = """\
To create and add a BGP peer for the Distributed Cloud Edge Network router
'my-router' in edge zone 'us-central1-edge-den1' , run:
$ {command} my-router --interface=my-int-r1 --peer-asn=33333 --peer-name=peer1 --peer-ipv4-range=208.117.254.232/31 --location=us-central1 --zone=us-central1-edge-den1
$ {command} my-router --interface=my-int-r1 --peer-asn=33333 --peer-name=peer1 --peer-ipv6-range=2001:0db8:85a3:0000:0000:8a2e:0370:7334/126 --location=us-central1 --zone=us-central1-edge-den1
"""
@base.ReleaseTracks(base.ReleaseTrack.ALPHA)
class AddBgpPeerAlpha(base.UpdateCommand):
"""Add a BGP peer to a Distributed Cloud Edge Network router.
*{command}* is used to add a BGP peer to a Distributed Cloud Edge Network
router.
"""
detailed_help = {'DESCRIPTION': DESCRIPTION, 'EXAMPLES': EXAMPLES_ALPHA}
@classmethod
def Args(cls, parser):
resource_args.AddRouterResourceArg(
parser, 'to which we add a bgp peer', True
)
routers_flags.AddBgpPeerArgs(
parser,
for_update=False,
enable_peer_ipv6_range=True,
)
base.ASYNC_FLAG.AddToParser(parser)
def Run(self, args):
routers_client = routers.RoutersClient(self.ReleaseTrack())
router_ref = args.CONCEPTS.router.Parse()
update_req_op = routers_client.AddBgpPeer(router_ref, args)
async_ = args.async_
if not async_:
response = routers_client.WaitForOperation(update_req_op)
log.UpdatedResource(
router_ref.RelativeName(), details='Operation was successful.'
)
return response
log.status.Print(
'Updating [{0}] with operation [{1}].'.format(
router_ref.RelativeName(), update_req_op.name
)
)
@base.ReleaseTracks(base.ReleaseTrack.GA)
class AddBgpPeer(base.UpdateCommand):
"""Add a BGP peer to a Distributed Cloud Edge Network router.
*{command}* is used to add a BGP peer to a Distributed Cloud Edge Network
router.
"""
detailed_help = {'DESCRIPTION': DESCRIPTION, 'EXAMPLES': EXAMPLES_GA}
@classmethod
def Args(cls, parser):
resource_args.AddRouterResourceArg(
parser, 'to which we add a bgp peer', True
)
routers_flags.AddBgpPeerArgs(parser)
base.ASYNC_FLAG.AddToParser(parser)
def Run(self, args):
routers_client = routers.RoutersClient(self.ReleaseTrack())
router_ref = args.CONCEPTS.router.Parse()
update_req_op = routers_client.AddBgpPeer(router_ref, args)
async_ = args.async_
if not async_:
response = routers_client.WaitForOperation(update_req_op)
log.UpdatedResource(
router_ref.RelativeName(), details='Operation was successful.')
return response
log.status.Print('Updating [{0}] with operation [{1}].'.format(
router_ref.RelativeName(), update_req_op.name))

View File

@@ -0,0 +1,75 @@
# -*- 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 add an interface to a Distributed Cloud Edge Network router."""
from __future__ import absolute_import
from __future__ import division
from __future__ import unicode_literals
from googlecloudsdk.api_lib.edge_cloud.networking.routers import routers
from googlecloudsdk.calliope import base
from googlecloudsdk.command_lib.edge_cloud.networking import resource_args
from googlecloudsdk.command_lib.edge_cloud.networking.routers import flags as routers_flags
from googlecloudsdk.core import log
DESCRIPTION = 'Create an interface to a Distributed Cloud Edge Network router.'
EXAMPLES = """\
To create and add a northbound interface for Distributed Cloud Edge Network router 'my-router' in edge zone 'us-central1-edge-den1' , run:
$ {command} my-router --interface-name=my-int-r1 --interconnect-attachment=my-link-attachment --ip-address=208.117.254.233 --ip-mask-length=31 --location=us-central1 --zone=us-central1-edge-den1
To create and add a southbound interface for Distributed Cloud Edge Network router 'my-router' in edge zone 'us-central1-edge-den1', run:
$ {command} my-router --interface-name=my-int-r2 --subnetwork=my-subnet --location=us-central1 --zone=us-central1-edge-den1
"""
@base.ReleaseTracks(base.ReleaseTrack.ALPHA, base.ReleaseTrack.GA)
class AddInterface(base.UpdateCommand):
"""Add an interface to a Distributed Cloud Edge Network router.
*{command}* is used to add an interface to a Distributed Cloud Edge Network
router.
"""
detailed_help = {'DESCRIPTION': DESCRIPTION, 'EXAMPLES': EXAMPLES}
@classmethod
def Args(cls, parser):
resource_args.AddRouterResourceArg(
parser, 'to which we add an interface', True
)
routers_flags.AddInterfaceArgs(parser)
base.ASYNC_FLAG.AddToParser(parser)
def Run(self, args):
routers_client = routers.RoutersClient(self.ReleaseTrack())
router_ref = args.CONCEPTS.router.Parse()
update_req_op = routers_client.AddInterface(router_ref, args)
async_ = getattr(args, 'async_', False)
if not async_:
response = routers_client.WaitForOperation(update_req_op)
log.UpdatedResource(
router_ref.RelativeName(), details='Operation was successful.'
)
return response
log.status.Print(
'Updating [{0}] with operation [{1}].'.format(
router_ref.RelativeName(), update_req_op.name
)
)

View File

@@ -0,0 +1,55 @@
- release_tracks: [ALPHA, GA]
help_text:
brief: Create a Distributed Cloud Edge Network router.
description: |
Create a new Distributed Cloud Edge Network router.
examples: |
To create a router called 'my-router' with asn 65555 in edge zone 'us-central1-edge-den1', run:
$ {command} my-router --network=my-network --location=us-central1 --zone=us-central1-edge-den1
--asn=65555
request:
collection: edgenetwork.projects.locations.zones.routers
ALPHA:
api_version: v1alpha1
GA:
api_version: v1
modify_request_hooks:
- googlecloudsdk.command_lib.edge_cloud.networking.resources:SetResourcesPathForRouter
arguments:
resource:
help_text: Distributed Cloud Edge Network router to create.
# The following should point to the resource argument definition under
# your surface's command_lib directory.:
spec: !REF googlecloudsdk.command_lib.edge_cloud.networking.resources:router
params:
- arg_name: network
api_field: router.network
required: true
help_text: |
The network that this subnetwork belongs to.
- arg_name: asn
api_field: router.bgp.asn
required: true
help_text: |
The locally assigned BGP ASN.
- arg_name: keepalive-interval-in-seconds
api_field: router.bgp.keepaliveIntervalInSeconds
type: int
default: 20
hidden: true
help_text: |
The interval in seconds between BGP keepalive messages that are sent to the peer.
- arg_name: description
api_field: router.description
help_text: |
An optional, textual description for the router.
labels:
api_field: router.labels
async:
collection: edgenetwork.projects.locations.operations

View File

@@ -0,0 +1,27 @@
- release_tracks: [ALPHA, GA]
help_text:
brief: Delete a Distributed Cloud Edge Network router.
description: |
Delete a Distributed Cloud Edge Network router.
examples: |
To delete a router called 'my-router' in edge zone 'us-central1-edge-den1', run:
$ {command} my-router --location=us-central1 --zone=us-central1-edge-den1
request:
collection: edgenetwork.projects.locations.zones.routers
ALPHA:
api_version: v1alpha1
GA:
api_version: v1
arguments:
resource:
help_text: Distributed Cloud Edge Network router to delete.
# The following should point to the resource argument definition under your
# surface's command_lib directory.:
spec: !REF googlecloudsdk.command_lib.edge_cloud.networking.resources:router
async:
collection: edgenetwork.projects.locations.operations

View File

@@ -0,0 +1,24 @@
release_tracks: [ALPHA, GA]
help_text:
brief: Show details about the Distributed Cloud Edge Network router.
description: |
Show details about the Distributed Cloud Edge Network router.
examples: |
To show details about a router named 'my-router' in edge zone 'us-central1-edge-den1', run:
$ {command} my-router --location=us-central1 --zone=us-central1-edge-den1
request:
collection: edgenetwork.projects.locations.zones.routers
ALPHA:
api_version: v1alpha1
GA:
api_version: v1
arguments:
resource:
help_text: The router you want to describe.
# The following should point to the resource argument definition under your
# surface's command_lib directory.:
spec: !REF googlecloudsdk.command_lib.edge_cloud.networking.resources:router

View File

@@ -0,0 +1,64 @@
# -*- 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 get the status of a Distributed Cloud Edge Network router."""
from __future__ import absolute_import
from __future__ import division
from __future__ import unicode_literals
from googlecloudsdk.api_lib.edge_cloud.networking.routers import routers
from googlecloudsdk.calliope import base
from googlecloudsdk.command_lib.edge_cloud.networking import resource_args
DESCRIPTION = (
'Get the status of a specified Distributed Cloud Edge Network router.')
EXAMPLES = """\
To get the status of the Distributed Cloud Edge Network router
'my-router' in edge zone 'us-central1-edge-den1' , run:
$ {command} my-router --location=us-central1 --zone=us-central1-edge-den1
"""
@base.ReleaseTracks(base.ReleaseTrack.ALPHA, base.ReleaseTrack.GA)
class GetStatus(base.Command):
"""Get the status of a specified Distributed Cloud Edge Network router.
*{command}* is used to get the status of a Distributed Cloud Edge Network
router.
"""
detailed_help = {'DESCRIPTION': DESCRIPTION, 'EXAMPLES': EXAMPLES}
@staticmethod
def Args(parser):
resource_args.AddRouterResourceArg(parser, 'to get status', True)
def _PreprocessResult(self, router_status):
"""Make the nextHopReachable value explicit for each route status."""
# This is necessary because if nextHopReachable == false, then when it's
# serialized by the server it will not be included, but we want to print it
# out explicitly, whether it's true or false.
for route_status in router_status.result.staticRouteStatus:
route_status.nextHopReachable = bool(route_status.nextHopReachable)
return router_status
def Run(self, args):
routers_client = routers.RoutersClient(self.ReleaseTrack())
router_ref = args.CONCEPTS.router.Parse()
if self.ReleaseTrack() == base.ReleaseTrack.GA:
return routers_client.GetStatus(router_ref)
return self._PreprocessResult(routers_client.GetStatus(router_ref))

View File

@@ -0,0 +1,36 @@
- release_tracks: [ALPHA, GA]
help_text:
brief: List Distributed Cloud Edge Network routers.
description: |
List Distributed Cloud Edge Network routers.
examples: |
To list the routers in edge zone 'us-central1-edge-den1', run:
$ {command} --location=us-central1 --zone=us-central1-edge-den1
request:
collection: edgenetwork.projects.locations.zones.routers
ALPHA:
api_version: v1alpha1
GA:
api_version: v1
response:
id_field: name
arguments:
resource:
help_text: Parent Distributed Cloud Edge Network zone to list all contained Distributed Cloud Edge Network routers.
# The following should point to the parent resource argument definition
# under your surface's command_lib directory.:
spec: !REF googlecloudsdk.command_lib.edge_cloud.networking.resources:zone
output:
format: |
table(
name.basename():label=NAME,
network.basename():label=NETWORK,
bgp.asn:label=ASN,
state.sub("STATE_", ""):label=STATE
)

View File

@@ -0,0 +1,85 @@
# -*- 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 remove a BGP peer from a Distributed Cloud Edge Network router."""
from __future__ import absolute_import
from __future__ import division
from __future__ import unicode_literals
from googlecloudsdk.api_lib.edge_cloud.networking.routers import routers
from googlecloudsdk.calliope import arg_parsers
from googlecloudsdk.calliope import base
from googlecloudsdk.command_lib.edge_cloud.networking import resource_args
from googlecloudsdk.core import log
DESCRIPTION = (
'Delete a list of BGP peer from a Distributed Cloud Edge Network router'
)
EXAMPLES = """\
To delete a BGP peer 'peer1' from the Distributed Cloud Edge Network router 'my-router' in edge zone 'us-central1-edge-den1' , run:
$ {command} my-router --peer-name=peer1 --location=us-central1 --zone=us-central1-edge-den1
"""
@base.ReleaseTracks(base.ReleaseTrack.ALPHA, base.ReleaseTrack.GA)
class RemoveBgpPeer(base.UpdateCommand):
"""Remove a BGP peer from a Distributed Cloud Edge Network router.
*{command}* is used to delete a BGP peer from a Distributed Cloud
Edge
Network router.
"""
detailed_help = {'DESCRIPTION': DESCRIPTION, 'EXAMPLES': EXAMPLES}
@staticmethod
def Args(parser):
resource_args.AddRouterResourceArg(
parser, 'from which we delete a BGP peer', True
)
bgp_peer_parser = parser.add_mutually_exclusive_group(required=True)
bgp_peer_parser.add_argument(
'--peer-names',
type=arg_parsers.ArgList(),
metavar='PEER_NAME',
help="""The list of names for peers being removed.
Only single value allowed currently.
""",
)
bgp_peer_parser.add_argument(
'--peer-name', help='The name of the BGP peer being removed.'
)
base.ASYNC_FLAG.AddToParser(parser)
def Run(self, args):
routers_client = routers.RoutersClient(self.ReleaseTrack())
router_ref = args.CONCEPTS.router.Parse()
update_req_op = routers_client.RemoveBgpPeer(router_ref, args)
async_ = args.async_
if not async_:
response = routers_client.WaitForOperation(update_req_op)
log.UpdatedResource(
router_ref.RelativeName(), details='Operation was successful.'
)
return response
log.status.Print(
'Updating [{0}] with operation [{1}].'.format(
router_ref.RelativeName(), update_req_op.name
)
)

View File

@@ -0,0 +1,74 @@
# -*- 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 an interface on a Distributed Cloud Edge Network router."""
from __future__ import absolute_import
from __future__ import division
from __future__ import unicode_literals
from googlecloudsdk.api_lib.edge_cloud.networking.routers import routers
from googlecloudsdk.calliope import arg_parsers
from googlecloudsdk.calliope import base
from googlecloudsdk.command_lib.edge_cloud.networking import resource_args
from googlecloudsdk.core import log
DESCRIPTION = ('Remove an interface on a Distributed Cloud Edge '
'Network router.')
EXAMPLES = """\
To remove the interface 'my-int-r1' on Distributed Cloud Edge Network router 'my-router' in edge zone 'us-central1-edge-den1' , run:
$ {command} my-router --interface-name=my-int-r1 --location=us-central1 --zone=us-central1-edge-den1
"""
@base.ReleaseTracks(base.ReleaseTrack.ALPHA, base.ReleaseTrack.GA)
class RemoveInterface(base.UpdateCommand):
"""remove an interface on a Distributed Cloud Edge Network router.
*{command}* is used to remove an interface to a Distributed Cloud Edge
Network router.
"""
detailed_help = {'DESCRIPTION': DESCRIPTION, 'EXAMPLES': EXAMPLES}
@staticmethod
def Args(parser):
resource_args.AddRouterResourceArg(parser,
'from which we remove an interface',
True)
interface_parser = parser.add_mutually_exclusive_group(required=True)
interface_parser.add_argument(
'--interface-names',
type=arg_parsers.ArgList(),
metavar='INTERFACE_NAME',
help='The list of names for interfaces being removed.')
interface_parser.add_argument(
'--interface-name', help='The name of the interface being removed.')
base.ASYNC_FLAG.AddToParser(parser)
def Run(self, args):
routers_client = routers.RoutersClient(self.ReleaseTrack())
router_ref = args.CONCEPTS.router.Parse()
update_req_op = routers_client.RemoveInterface(router_ref, args)
async_ = getattr(args, 'async_', False)
if not async_:
response = routers_client.WaitForOperation(update_req_op)
log.UpdatedResource(
router_ref.RelativeName(), details='Operation was successful.')
return response
log.status.Print('Updating [{0}] with operation [{1}].'.format(
router_ref.RelativeName(), update_req_op.name))

View File

@@ -0,0 +1,99 @@
# -*- 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 update a Distributed Cloud Edge Network router."""
from __future__ import absolute_import
from __future__ import division
from __future__ import unicode_literals
from googlecloudsdk.api_lib.edge_cloud.networking.routers import routers
from googlecloudsdk.calliope import base
from googlecloudsdk.command_lib.edge_cloud.networking import resource_args
from googlecloudsdk.command_lib.edge_cloud.networking.routers import flags as routers_flags
from googlecloudsdk.core import log
DESCRIPTION = """Update a Distributed Cloud Edge Network router.
Note that `update` operations are not thread-safe, meaning that if more than one
user is updating a router at a time, there can be race conditions. Please ensure
that at most one `update` operation is being applied to a given router at a
time.
"""
EXAMPLES = """\
To add a northbound route advertisement for destination range 8.8.0.0/16 for Distributed Cloud Edge Network router 'my-router' in edge zone 'us-central1-edge-den1' , run:
$ {command} my-router --add-advertisement-ranges=8.8.0.0/16 --location=us-central1 --zone=us-central1-edge-den1
To remove a northbound route advertisement for destination range 8.8.0.0/16 for Distributed Cloud Edge Network router 'my-router' in edge zone 'us-central1-edge-den1' , run:
$ {command} my-router --remove-advertisement-ranges=8.8.0.0/16 --location=us-central1 --zone=us-central1-edge-den1
To replace the set of route advertisements with just 8.8.0.0/16 and 1.1.0.0/16, in Distributed Cloud Edge Network router 'my-router' in edge zone 'us-central1-edge-den1' , run:
$ {command} my-router --set-advertisement-ranges=8.8.0.0/16,1.1.0.0/16 --location=us-central1 --zone=us-central1-edge-den1
"""
@base.ReleaseTracks(base.ReleaseTrack.ALPHA)
class Update(base.UpdateCommand):
"""Update a Distributed Cloud Edge Network router.
*{command}* is used update a Distributed Cloud Edge Network router.
"""
detailed_help = {'DESCRIPTION': DESCRIPTION, 'EXAMPLES': EXAMPLES}
@staticmethod
def Args(parser):
resource_args.AddRouterResourceArg(parser, 'to be updated', True)
routers_flags.AddUpdateArgs(parser)
base.ASYNC_FLAG.AddToParser(parser)
def Run(self, args):
routers_client = routers.RoutersClient(self.ReleaseTrack())
router_ref = args.CONCEPTS.router.Parse()
if not self.has_routes_arg(args):
return
update_req_op = routers_client.ChangeAdvertisements(router_ref, args)
async_ = getattr(args, 'async_', False)
if not async_:
response = routers_client.WaitForOperation(update_req_op)
log.UpdatedResource(
router_ref.RelativeName(), details='Operation was successful.')
return response
log.status.Print('Updating [{0}] with operation [{1}].'.format(
router_ref.RelativeName(), update_req_op.name))
def has_routes_arg(self, args):
relevant_args = [
args.add_advertisement_ranges,
args.remove_advertisement_ranges,
args.set_advertisement_ranges,
]
filtered = filter(None, relevant_args)
number_found = sum(1 for _ in filtered)
if number_found == 0:
return False
if number_found == 1:
return True
raise ValueError(
'Invalid argument: Expected at most one of add_advertisement_ranges '
'remove_advertisement_ranges set_advertisement_ranges')

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 Distributed Cloud Edge Network routes resource."""
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 Routes(base.Group):
"""Manage Distributed Cloud Edge Network routes."""

View File

@@ -0,0 +1,55 @@
- release_tracks: [ALPHA]
help_text:
brief: Create a Distributed Cloud Edge Network route.
description: |
Create a new Distributed Cloud Edge Network route.
examples: |
To create a route called `AMF_OAM_VRF_1_macVlan` in zone `us-east1-den3`,
with destination range `10.145.201.1/32`, and next hop of `10.140.65.2`,
use the command
$ {command} AMF_OAM_VRF_1_macVlan \
--network=AMF_OAM \
--destination-range=10.145.201.1/32 \
--zone=us-east1-den3 \
--next-hop-address=10.140.64.2
request:
collection: edgenetwork.projects.locations.zones.routes
api_version: v1alpha1
modify_request_hooks:
- googlecloudsdk.command_lib.edge_cloud.networking.resources:SetResourcesPathForRoute
arguments:
resource:
help_text: Distributed Cloud Edge Network route to create.
# The following should point to the resource argument definition under
# your surface's command_lib directory.:
spec: !REF googlecloudsdk.command_lib.edge_cloud.networking.resources:route
params:
- arg_name: network
api_field: route.network
required: true
help_text: |
Network that this route belongs to.
- arg_name: destination-range
api_field: route.destinationCidr
required: true
help_text: |
Destination subnet of this route (in CIDR format).
- arg_name: next-hop-address
api_field: route.nextHopAddress
required: true
help_text: |
IP address of the next hop along this route.
- arg_name: description
api_field: route.description
help_text: |
An optional, textual description for the route.
labels:
api_field: route.labels
async:
collection: edgenetwork.projects.locations.operations

View File

@@ -0,0 +1,26 @@
- release_tracks: [ALPHA]
help_text:
brief: Delete a Distributed Cloud Edge Network route.
description: |
Delete a Distributed Cloud Edge Network route.
examples: |
To delete a route called `AMF_OAM_VRF_1_macVlan` in edge zone `us-central1-edge-den1`, run:
$ {command} 'AMF_OAM_VRF_1_macVlan' \
--location=us-central1 \
--zone=us-central1-edge-den1
request:
collection: edgenetwork.projects.locations.zones.routes
api_version: v1alpha1
arguments:
resource:
help_text: Distributed Cloud Edge Network route to delete.
# The following should point to the resource argument definition under your
# surface's command_lib directory.:
spec: !REF googlecloudsdk.command_lib.edge_cloud.networking.resources:route
async:
collection: edgenetwork.projects.locations.operations

View File

@@ -0,0 +1,21 @@
release_tracks: [ALPHA]
help_text:
brief: Show details about the Distributed Cloud Edge Network route.
description: |
Show details about the Distributed Cloud Edge Network route.
examples: |
To show details about a route named `my-route` in edge zone `us-central1-edge-den1`, run:
$ {command} my-route --location=us-central1 --zone=us-central1-edge-den1
request:
collection: edgenetwork.projects.locations.zones.routes
api_version: v1alpha1
arguments:
resource:
help_text: The route you want to describe.
# The following should point to the resource argument definition under your
# surface's command_lib directory.:
spec: !REF googlecloudsdk.command_lib.edge_cloud.networking.resources:route

View File

@@ -0,0 +1,34 @@
- release_tracks: [ALPHA]
help_text:
brief: List Distributed Cloud Edge Network routes.
description: |
List Distributed Cloud Edge Network routes.
examples: |
To list the routes in edge zone `us-central1-edge-den1`, run:
$ {command} --location=us-central1 --zone=us-central1-edge-den1
request:
collection: edgenetwork.projects.locations.zones.routes
api_version: v1alpha1
response:
id_field: name
arguments:
resource:
help_text: Parent Distributed Cloud Edge Network zone to list all contained Distributed Cloud Edge Network routes.
# The following should point to the parent resource argument definition
# under your surface's command_lib directory.:
spec: !REF googlecloudsdk.command_lib.edge_cloud.networking.resources:zone
output:
format: |
table(
name.basename():label=NAME,
network.basename():label=NETWORK,
nextHopAddress:label=NEXT_HOP,
destinationCidr:label=DESTINATION_CIDR,
state:label=STATE
)

View File

@@ -0,0 +1,26 @@
# -*- 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 subnet resource."""
from __future__ import absolute_import
from __future__ import division
from __future__ import unicode_literals
from googlecloudsdk.calliope import base
@base.ReleaseTracks(base.ReleaseTrack.ALPHA, base.ReleaseTrack.GA)
class Subnets(base.Group):
"""Manage Distributed Cloud Edge Network subnets."""

View File

@@ -0,0 +1,62 @@
- release_tracks: [ALPHA, GA]
help_text:
brief: Create a Distributed Cloud Edge Network subnet.
description: |
Create a new Distributed Cloud Edge Network subnet.
examples: |
To create a Distributed Cloud Edge Network subnet called `my-subnet` with VLAN ID and owned ip ranges specified in the edge zone 'us-central1-edge-den1', run:
$ {command} my-subnet --network=my-network --location=us-central1 --zone=us-central1-edge-den1 --ipv4-range=192.168.1.1/24,172.10.10.1/24 --ipv6-range=2001:db8::1/64,4001:230::1/64 --vlan-id=100 --bonding-type=bonded
request:
collection: edgenetwork.projects.locations.zones.subnets
ALPHA:
api_version: v1alpha1
GA:
api_version: v1
modify_request_hooks:
- googlecloudsdk.command_lib.edge_cloud.networking.resources:SetResourcesPathForSubnet
arguments:
resource:
help_text: Distributed Cloud Edge Network subnet to create.
# The following should point to the resource argument definition under
# your surface's command_lib directory.:
spec: !REF googlecloudsdk.command_lib.edge_cloud.networking.resources:subnet
params:
- arg_name: description
api_field: subnet.description
help_text: |
An optional, textual description for the subnet.
- arg_name: ipv4-range
api_field: subnet.ipv4Cidr
type: "googlecloudsdk.calliope.arg_parsers:ArgList:"
help_text: |
The ranges of ipv4 addresses that are owned by this subnetwork in CIDR format.
- arg_name: ipv6-range
api_field: subnet.ipv6Cidr
type: "googlecloudsdk.calliope.arg_parsers:ArgList:"
help_text: |
The ranges of ipv6 addresses that are owned by this subnetwork in CIDR format.
- arg_name: network
api_field: subnet.network
required: true
help_text: |
The network that this subnetwork belongs to.
- arg_name: vlan-id
api_field: subnet.vlanId
type: int
help_text: |
The ID of the VLAN to tag the subnetwork. If not specified we assign one automatically.
- arg_name: bonding-type
api_field: subnet.bondingType
help_text: |
Whether or not the VLAN being created will be present on bonded or non-bonded port types. If not specified, the VLAN will be created on both port types by default.
release_tracks: [ALPHA]
labels:
api_field: subnet.labels
async:
collection: edgenetwork.projects.locations.operations

View File

@@ -0,0 +1,27 @@
- release_tracks: [ALPHA, GA]
help_text:
brief: Delete a Distributed Cloud Edge Network subnet.
description: |
Delete a Distributed Cloud Edge Network subnet.
examples: |
To delete a subnet called 'my-subnet' in the edge zone 'us-central1-edge-den1', run:
$ {command} my-subnet --location=us-central1 --zone=us-central1-edge-den1
request:
collection: edgenetwork.projects.locations.zones.subnets
ALPHA:
api_version: v1alpha1
GA:
api_version: v1
arguments:
resource:
help_text: Distributed Cloud Edge Network subnet to delete.
# The following should point to the resource argument definition under your
# surface's command_lib directory.:
spec: !REF googlecloudsdk.command_lib.edge_cloud.networking.resources:subnet
async:
collection: edgenetwork.projects.locations.operations

View File

@@ -0,0 +1,24 @@
release_tracks: [ALPHA, GA]
help_text:
brief: Show details about the Distributed Cloud Edge Network subnet.
description: |
Show details about the Distributed Cloud Edge Network subnet.
examples: |
To show details about a subnet named 'my-subnet' in the edge zone 'us-central1-edge-den1', run:
$ {command} my-subnet --location=us-central1 --zone=us-central1-edge-den1
request:
collection: edgenetwork.projects.locations.zones.subnets
ALPHA:
api_version: v1alpha1
GA:
api_version: v1
arguments:
resource:
help_text: The subnet you want to describe.
# The following should point to the resource argument definition under your
# surface's command_lib directory.:
spec: !REF googlecloudsdk.command_lib.edge_cloud.networking.resources:subnet

View File

@@ -0,0 +1,38 @@
- release_tracks: [ALPHA, GA]
help_text:
brief: List Distributed Cloud Edge Network subnets.
description: |
List Distributed Cloud Edge Network subnets.
examples: |
To list the subnets in the edge zone 'us-central1-edge-den1', run:
$ {command} --location=us-central1 --zone=us-central1-edge-den1
request:
collection: edgenetwork.projects.locations.zones.subnets
ALPHA:
api_version: v1alpha1
GA:
api_version: v1
response:
id_field: name
arguments:
resource:
help_text: Parent Distributed Cloud Edge Network zone to list all contained Distributed Cloud Edge Network subnets.
# The following should point to the parent resource argument definition
# under your surface's command_lib directory.:
spec: !REF googlecloudsdk.command_lib.edge_cloud.networking.resources:zone
output:
format: |
table(
name.basename():label=NAME,
network.basename():label=NETWORK,
vlanId:label=VLANID,
ipv4Cidr.list():label=IPV4CIDR,
ipv6Cidr.list():label=IPV6CIDR,
state.sub("STATE_", ""):label=STATE
)

View File

@@ -0,0 +1,26 @@
# -*- 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 zone resource."""
from __future__ import absolute_import
from __future__ import division
from __future__ import unicode_literals
from googlecloudsdk.calliope import base
@base.ReleaseTracks(base.ReleaseTrack.ALPHA, base.ReleaseTrack.GA)
class Zones(base.Group):
"""Manage Distributed Cloud Edge Network zones."""

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 initialize a Distributed Cloud Edge Network zone."""
from __future__ import absolute_import
from __future__ import division
from __future__ import unicode_literals
from googlecloudsdk.api_lib.edge_cloud.networking.zones import zones
from googlecloudsdk.calliope import base
from googlecloudsdk.command_lib.edge_cloud.networking import resource_args
from googlecloudsdk.core import log
DESCRIPTION = ('Initialize a specified Distributed Cloud Edge Network zone.')
EXAMPLES = """\
To initialize a Distributed Cloud Edge Network zone called
'us-central1-edge-den1', run:
$ {command} us-central1-edge-den1 --location=us-central1
"""
@base.ReleaseTracks(base.ReleaseTrack.ALPHA, base.ReleaseTrack.GA)
class InitialzeZone(base.Command):
"""Initialize a specified Distributed Cloud Edge Network zone.
*{command}* is used to initialize a Distributed Cloud Edge Network
zone.
"""
detailed_help = {'DESCRIPTION': DESCRIPTION, 'EXAMPLES': EXAMPLES}
@staticmethod
def Args(parser):
resource_args.AddZoneResourceArg(parser, 'to initialize', True)
def Run(self, args):
zones_client = zones.ZonesClient(self.ReleaseTrack())
zone_ref = args.CONCEPTS.zone.Parse()
log.status.Print('Starting to initialize the zone...')
zones_client.InitializeZone(zone_ref)
log.status.Print('Initialized zone [{0}].'.format(zone_ref.RelativeName()))