From 5f272b3293fe54dd7d73930cdd2e634b15ed3e2f Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Thu, 27 Jun 2024 18:34:33 +0000 Subject: [PATCH] feat: [google-cloud-edgenetwork] A new field `bonding_type` is added to message `.google.cloud.edgenetwork.v1.Subnet` (#12842) - [ ] Regenerate this pull request now. PiperOrigin-RevId: 646953813 Source-Link: https://github.com/googleapis/googleapis/commit/16c01b440273ed685ae1d1ec7863d0f95f2a138d Source-Link: https://github.com/googleapis/googleapis-gen/commit/18700299f97abb07c56bf5ed1056219f809defb4 Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLWVkZ2VuZXR3b3JrLy5Pd2xCb3QueWFtbCIsImgiOiIxODcwMDI5OWY5N2FiYjA3YzU2YmY1ZWQxMDU2MjE5ZjgwOWRlZmI0In0= --------- Co-authored-by: Owl Bot Co-authored-by: Victor Chudnovsky --- packages/google-cloud-edgenetwork/README.rst | 2 +- .../google-cloud-edgenetwork/docs/index.rst | 5 ++ .../docs/summary_overview.md | 22 +++++++++ .../cloud/edgenetwork_v1/types/resources.py | 35 ++++++++++++++ packages/google-cloud-edgenetwork/noxfile.py | 46 ++++++++++++++----- .../gapic/edgenetwork_v1/test_edge_network.py | 9 ++++ 6 files changed, 107 insertions(+), 12 deletions(-) create mode 100644 packages/google-cloud-edgenetwork/docs/summary_overview.md diff --git a/packages/google-cloud-edgenetwork/README.rst b/packages/google-cloud-edgenetwork/README.rst index d6ba04f873d7..a0f379a716b1 100644 --- a/packages/google-cloud-edgenetwork/README.rst +++ b/packages/google-cloud-edgenetwork/README.rst @@ -15,7 +15,7 @@ Python Client for Distributed Cloud Edge Network API .. |versions| image:: https://img.shields.io/pypi/pyversions/google-cloud-edgenetwork.svg :target: https://pypi.org/project/google-cloud-edgenetwork/ .. _Distributed Cloud Edge Network API: https://cloud.google.com/distributed-cloud/edge/latest/docs/overview -.. _Client Library Documentation: https://cloud.google.com/python/docs/reference/google-cloud-edgenetwork/latest +.. _Client Library Documentation: https://cloud.google.com/python/docs/reference/google-cloud-edgenetwork/latest/summary_overview .. _Product Documentation: https://cloud.google.com/distributed-cloud/edge/latest/docs/overview Quick Start diff --git a/packages/google-cloud-edgenetwork/docs/index.rst b/packages/google-cloud-edgenetwork/docs/index.rst index 5bfc41da6ad3..4bf5c7b789d9 100644 --- a/packages/google-cloud-edgenetwork/docs/index.rst +++ b/packages/google-cloud-edgenetwork/docs/index.rst @@ -21,3 +21,8 @@ For a list of all ``google-cloud-edgenetwork`` releases: :maxdepth: 2 CHANGELOG + +.. toctree:: + :hidden: + + summary_overview.md diff --git a/packages/google-cloud-edgenetwork/docs/summary_overview.md b/packages/google-cloud-edgenetwork/docs/summary_overview.md new file mode 100644 index 000000000000..b5efb059b3ec --- /dev/null +++ b/packages/google-cloud-edgenetwork/docs/summary_overview.md @@ -0,0 +1,22 @@ +[ +This is a templated file. Adding content to this file may result in it being +reverted. Instead, if you want to place additional content, create an +"overview_content.md" file in `docs/` directory. The Sphinx tool will +pick up on the content and merge the content. +]: # + +# Distributed Cloud Edge Network API API + +Overview of the APIs available for Distributed Cloud Edge Network API API. + +## All entries + +Classes, methods and properties & attributes for +Distributed Cloud Edge Network API API. + +[classes](https://cloud.google.com/python/docs/reference/google-cloud-edgenetwork/latest/summary_class.html) + +[methods](https://cloud.google.com/python/docs/reference/google-cloud-edgenetwork/latest/summary_method.html) + +[properties and +attributes](https://cloud.google.com/python/docs/reference/google-cloud-edgenetwork/latest/summary_property.html) diff --git a/packages/google-cloud-edgenetwork/google/cloud/edgenetwork_v1/types/resources.py b/packages/google-cloud-edgenetwork/google/cloud/edgenetwork_v1/types/resources.py index a75a5fe01618..89d66c38ca2b 100644 --- a/packages/google-cloud-edgenetwork/google/cloud/edgenetwork_v1/types/resources.py +++ b/packages/google-cloud-edgenetwork/google/cloud/edgenetwork_v1/types/resources.py @@ -198,11 +198,40 @@ class Subnet(proto.Message): vlan_id (int): Optional. VLAN id provided by user. If not specified we assign one automatically. + bonding_type (google.cloud.edgenetwork_v1.types.Subnet.BondingType): + Optional. A bonding type in the subnet + creation specifies whether a VLAN being created + will be present on Bonded or Non-Bonded or Both + port types. In addition, this flag is to be used + to set the specific network configuration which + clusters can then use for their workloads based + on the bonding choice. state (google.cloud.edgenetwork_v1.types.ResourceState): Output only. Current stage of the resource to the device by config push. """ + class BondingType(proto.Enum): + r"""Bonding type in the subnet. + + Values: + BONDING_TYPE_UNSPECIFIED (0): + Unspecified + Bonding type will be unspecified by default and + if the user chooses to not specify a bonding + type at time of creating the VLAN. This will be + treated as mixed bonding where the VLAN will + have both bonded and non-bonded connectivity to + machines. + BONDED (1): + Single homed. + NON_BONDED (2): + Multi homed. + """ + BONDING_TYPE_UNSPECIFIED = 0 + BONDED = 1 + NON_BONDED = 2 + name: str = proto.Field( proto.STRING, number=1, @@ -242,6 +271,11 @@ class Subnet(proto.Message): proto.INT32, number=9, ) + bonding_type: BondingType = proto.Field( + proto.ENUM, + number=11, + enum=BondingType, + ) state: "ResourceState" = proto.Field( proto.ENUM, number=10, @@ -996,6 +1030,7 @@ class BgpStatus(proto.Enum): The DOWN state indicating BGP session is not established yet. """ + UNKNOWN = 0 UP = 1 DOWN = 2 diff --git a/packages/google-cloud-edgenetwork/noxfile.py b/packages/google-cloud-edgenetwork/noxfile.py index 1e6cd48d0529..67b7265f7586 100644 --- a/packages/google-cloud-edgenetwork/noxfile.py +++ b/packages/google-cloud-edgenetwork/noxfile.py @@ -160,14 +160,28 @@ def install_unittest_dependencies(session, *constraints): session.install("-e", ".", *constraints) -def default(session): +@nox.session(python=UNIT_TEST_PYTHON_VERSIONS) +@nox.parametrize( + "protobuf_implementation", + ["python", "upb", "cpp"], +) +def unit(session, protobuf_implementation): # Install all test dependencies, then install this package in-place. + if protobuf_implementation == "cpp" and session.python in ("3.11", "3.12"): + session.skip("cpp implementation is not supported in python 3.11+") + constraints_path = str( CURRENT_DIRECTORY / "testing" / f"constraints-{session.python}.txt" ) install_unittest_dependencies(session, "-c", constraints_path) + # TODO(https://github.com/googleapis/synthtool/issues/1976): + # Remove the 'cpp' implementation once support for Protobuf 3.x is dropped. + # The 'cpp' implementation requires Protobuf<4. + if protobuf_implementation == "cpp": + session.install("protobuf<4") + # Run py.test against the unit tests. session.run( "py.test", @@ -181,15 +195,12 @@ def default(session): "--cov-fail-under=0", os.path.join("tests", "unit"), *session.posargs, + env={ + "PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION": protobuf_implementation, + }, ) -@nox.session(python=UNIT_TEST_PYTHON_VERSIONS) -def unit(session): - """Run the unit test suite.""" - default(session) - - def install_systemtest_dependencies(session, *constraints): # Use pre-release gRPC for system tests. # Exclude version 1.52.0rc1 which has a known issue. @@ -358,9 +369,16 @@ def docfx(session): @nox.session(python="3.12") -def prerelease_deps(session): +@nox.parametrize( + "protobuf_implementation", + ["python", "upb", "cpp"], +) +def prerelease_deps(session, protobuf_implementation): """Run all tests with prerelease versions of dependencies installed.""" + if protobuf_implementation == "cpp" and session.python in ("3.11", "3.12"): + session.skip("cpp implementation is not supported in python 3.11+") + # Install all dependencies session.install("-e", ".[all, tests, tracing]") unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES @@ -397,9 +415,9 @@ def prerelease_deps(session): "protobuf", # dependency of grpc "six", + "grpc-google-iam-v1", "googleapis-common-protos", - # Exclude version 1.52.0rc1 which has a known issue. See https://github.com/grpc/grpc/issues/32163 - "grpcio!=1.52.0rc1", + "grpcio", "grpcio-status", "google-api-core", "google-auth", @@ -425,4 +443,10 @@ def prerelease_deps(session): session.run("python", "-c", "import grpc; print(grpc.__version__)") session.run("python", "-c", "import google.auth; print(google.auth.__version__)") - session.run("py.test", "tests/unit") + session.run( + "py.test", + "tests/unit", + env={ + "PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION": protobuf_implementation, + }, + ) diff --git a/packages/google-cloud-edgenetwork/tests/unit/gapic/edgenetwork_v1/test_edge_network.py b/packages/google-cloud-edgenetwork/tests/unit/gapic/edgenetwork_v1/test_edge_network.py index d1c7069c2007..c2bad4440a94 100644 --- a/packages/google-cloud-edgenetwork/tests/unit/gapic/edgenetwork_v1/test_edge_network.py +++ b/packages/google-cloud-edgenetwork/tests/unit/gapic/edgenetwork_v1/test_edge_network.py @@ -5059,6 +5059,7 @@ def test_get_subnet(request_type, transport: str = "grpc"): ipv4_cidr=["ipv4_cidr_value"], ipv6_cidr=["ipv6_cidr_value"], vlan_id=733, + bonding_type=resources.Subnet.BondingType.BONDED, state=resources.ResourceState.STATE_PENDING, ) response = client.get_subnet(request) @@ -5077,6 +5078,7 @@ def test_get_subnet(request_type, transport: str = "grpc"): assert response.ipv4_cidr == ["ipv4_cidr_value"] assert response.ipv6_cidr == ["ipv6_cidr_value"] assert response.vlan_id == 733 + assert response.bonding_type == resources.Subnet.BondingType.BONDED assert response.state == resources.ResourceState.STATE_PENDING @@ -5182,6 +5184,7 @@ async def test_get_subnet_empty_call_async(): ipv4_cidr=["ipv4_cidr_value"], ipv6_cidr=["ipv6_cidr_value"], vlan_id=733, + bonding_type=resources.Subnet.BondingType.BONDED, state=resources.ResourceState.STATE_PENDING, ) ) @@ -5259,6 +5262,7 @@ async def test_get_subnet_async( ipv4_cidr=["ipv4_cidr_value"], ipv6_cidr=["ipv6_cidr_value"], vlan_id=733, + bonding_type=resources.Subnet.BondingType.BONDED, state=resources.ResourceState.STATE_PENDING, ) ) @@ -5278,6 +5282,7 @@ async def test_get_subnet_async( assert response.ipv4_cidr == ["ipv4_cidr_value"] assert response.ipv6_cidr == ["ipv6_cidr_value"] assert response.vlan_id == 733 + assert response.bonding_type == resources.Subnet.BondingType.BONDED assert response.state == resources.ResourceState.STATE_PENDING @@ -15321,6 +15326,7 @@ def test_get_subnet_rest(request_type): ipv4_cidr=["ipv4_cidr_value"], ipv6_cidr=["ipv6_cidr_value"], vlan_id=733, + bonding_type=resources.Subnet.BondingType.BONDED, state=resources.ResourceState.STATE_PENDING, ) @@ -15343,6 +15349,7 @@ def test_get_subnet_rest(request_type): assert response.ipv4_cidr == ["ipv4_cidr_value"] assert response.ipv6_cidr == ["ipv6_cidr_value"] assert response.vlan_id == 733 + assert response.bonding_type == resources.Subnet.BondingType.BONDED assert response.state == resources.ResourceState.STATE_PENDING @@ -15632,6 +15639,7 @@ def test_create_subnet_rest(request_type): "ipv4_cidr": ["ipv4_cidr_value1", "ipv4_cidr_value2"], "ipv6_cidr": ["ipv6_cidr_value1", "ipv6_cidr_value2"], "vlan_id": 733, + "bonding_type": 1, "state": 1, } # The version of a generated dependency at test runtime may differ from the version used during generation. @@ -16049,6 +16057,7 @@ def test_update_subnet_rest(request_type): "ipv4_cidr": ["ipv4_cidr_value1", "ipv4_cidr_value2"], "ipv6_cidr": ["ipv6_cidr_value1", "ipv6_cidr_value2"], "vlan_id": 733, + "bonding_type": 1, "state": 1, } # The version of a generated dependency at test runtime may differ from the version used during generation.