From f40217da28be7729ae1c8a2a3378be267eb401d1 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Sat, 9 Mar 2024 06:06:57 -0500 Subject: [PATCH] feat: [google-cloud-network-management] add new NAT fields to Network Management API definition (#12431) - [ ] Regenerate this pull request now. BEGIN_COMMIT_OVERRIDE feat: Add new NAT fields to Network Management API definition feat: Add new load balancer fields to public API END_COMMIT_OVERRIDE PiperOrigin-RevId: 613999902 Source-Link: https://github.com/googleapis/googleapis/commit/87e7c58f3118b4c94a96dbb1f0eb53f96d2a2b54 Source-Link: https://github.com/googleapis/googleapis-gen/commit/009f2385d4e84eeb234b372ae91ecd38214c5565 Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLW5ldHdvcmstbWFuYWdlbWVudC8uT3dsQm90LnlhbWwiLCJoIjoiMDA5ZjIzODVkNGU4NGVlYjIzNGIzNzJhZTkxZWNkMzgyMTRjNTU2NSJ9 BEGIN_NESTED_COMMIT feat: [google-cloud-network-management] add new load balancer fields to public API PiperOrigin-RevId: 613975155 Source-Link: https://github.com/googleapis/googleapis/commit/4664532c20d8f916cd39fc50ec6c49cb4db62cee Source-Link: https://github.com/googleapis/googleapis-gen/commit/b5caec080bc0e5528dd392d704a166bbac3965bc Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLW5ldHdvcmstbWFuYWdlbWVudC8uT3dsQm90LnlhbWwiLCJoIjoiYjVjYWVjMDgwYmMwZTU1MjhkZDM5MmQ3MDRhMTY2YmJhYzM5NjViYyJ9 END_NESTED_COMMIT --------- Co-authored-by: Owl Bot Co-authored-by: Anthonios Partheniou --- .../cloud/network_management/__init__.py | 8 + .../cloud/network_management_v1/__init__.py | 8 + .../network_management_v1/types/__init__.py | 8 + .../types/connectivity_test.py | 2 +- .../network_management_v1/types/trace.py | 393 ++++++++++++++++++ .../test_reachability_service.py | 82 ++++ 6 files changed, 500 insertions(+), 1 deletion(-) diff --git a/packages/google-cloud-network-management/google/cloud/network_management/__init__.py b/packages/google-cloud-network-management/google/cloud/network_management/__init__.py index b93b4504a4e4..94171a345edf 100644 --- a/packages/google-cloud-network-management/google/cloud/network_management/__init__.py +++ b/packages/google-cloud-network-management/google/cloud/network_management/__init__.py @@ -58,11 +58,15 @@ GoogleServiceInfo, InstanceInfo, LoadBalancerBackend, + LoadBalancerBackendInfo, LoadBalancerInfo, LoadBalancerType, + NatInfo, NetworkInfo, + ProxyConnectionInfo, RouteInfo, Step, + StorageBucketInfo, Trace, VpcConnectorInfo, VpnGatewayInfo, @@ -101,10 +105,14 @@ "GoogleServiceInfo", "InstanceInfo", "LoadBalancerBackend", + "LoadBalancerBackendInfo", "LoadBalancerInfo", + "NatInfo", "NetworkInfo", + "ProxyConnectionInfo", "RouteInfo", "Step", + "StorageBucketInfo", "Trace", "VpcConnectorInfo", "VpnGatewayInfo", diff --git a/packages/google-cloud-network-management/google/cloud/network_management_v1/__init__.py b/packages/google-cloud-network-management/google/cloud/network_management_v1/__init__.py index 257100aac99f..9a5fa7f85e4d 100644 --- a/packages/google-cloud-network-management/google/cloud/network_management_v1/__init__.py +++ b/packages/google-cloud-network-management/google/cloud/network_management_v1/__init__.py @@ -56,11 +56,15 @@ GoogleServiceInfo, InstanceInfo, LoadBalancerBackend, + LoadBalancerBackendInfo, LoadBalancerInfo, LoadBalancerType, + NatInfo, NetworkInfo, + ProxyConnectionInfo, RouteInfo, Step, + StorageBucketInfo, Trace, VpcConnectorInfo, VpnGatewayInfo, @@ -93,16 +97,20 @@ "ListConnectivityTestsRequest", "ListConnectivityTestsResponse", "LoadBalancerBackend", + "LoadBalancerBackendInfo", "LoadBalancerInfo", "LoadBalancerType", + "NatInfo", "NetworkInfo", "OperationMetadata", "ProbingDetails", + "ProxyConnectionInfo", "ReachabilityDetails", "ReachabilityServiceClient", "RerunConnectivityTestRequest", "RouteInfo", "Step", + "StorageBucketInfo", "Trace", "UpdateConnectivityTestRequest", "VpcConnectorInfo", diff --git a/packages/google-cloud-network-management/google/cloud/network_management_v1/types/__init__.py b/packages/google-cloud-network-management/google/cloud/network_management_v1/types/__init__.py index b8ae9765ac9a..260f7ae86419 100644 --- a/packages/google-cloud-network-management/google/cloud/network_management_v1/types/__init__.py +++ b/packages/google-cloud-network-management/google/cloud/network_management_v1/types/__init__.py @@ -47,11 +47,15 @@ GoogleServiceInfo, InstanceInfo, LoadBalancerBackend, + LoadBalancerBackendInfo, LoadBalancerInfo, LoadBalancerType, + NatInfo, NetworkInfo, + ProxyConnectionInfo, RouteInfo, Step, + StorageBucketInfo, Trace, VpcConnectorInfo, VpnGatewayInfo, @@ -88,10 +92,14 @@ "GoogleServiceInfo", "InstanceInfo", "LoadBalancerBackend", + "LoadBalancerBackendInfo", "LoadBalancerInfo", + "NatInfo", "NetworkInfo", + "ProxyConnectionInfo", "RouteInfo", "Step", + "StorageBucketInfo", "Trace", "VpcConnectorInfo", "VpnGatewayInfo", diff --git a/packages/google-cloud-network-management/google/cloud/network_management_v1/types/connectivity_test.py b/packages/google-cloud-network-management/google/cloud/network_management_v1/types/connectivity_test.py index 109941ef110f..1ad7f5d63c6a 100644 --- a/packages/google-cloud-network-management/google/cloud/network_management_v1/types/connectivity_test.py +++ b/packages/google-cloud-network-management/google/cloud/network_management_v1/types/connectivity_test.py @@ -216,7 +216,7 @@ class Endpoint(proto.Message): provide forwarding information in the control plane. Format: - projects/{project}/global/forwardingRules/{id} + projects/{project}/global/forwardingRules/{id} or projects/{project}/regions/{region}/forwardingRules/{id} forwarding_rule_target (google.cloud.network_management_v1.types.Endpoint.ForwardingRuleTarget): diff --git a/packages/google-cloud-network-management/google/cloud/network_management_v1/types/trace.py b/packages/google-cloud-network-management/google/cloud/network_management_v1/types/trace.py index 9c25524cba7d..891afba96c5d 100644 --- a/packages/google-cloud-network-management/google/cloud/network_management_v1/types/trace.py +++ b/packages/google-cloud-network-management/google/cloud/network_management_v1/types/trace.py @@ -46,6 +46,10 @@ "CloudRunRevisionInfo", "AppEngineVersionInfo", "VpcConnectorInfo", + "NatInfo", + "ProxyConnectionInfo", + "LoadBalancerBackendInfo", + "StorageBucketInfo", }, ) @@ -261,6 +265,24 @@ class Step(proto.Message): cloud_run_revision (google.cloud.network_management_v1.types.CloudRunRevisionInfo): Display information of a Cloud Run revision. + This field is a member of `oneof`_ ``step_info``. + nat (google.cloud.network_management_v1.types.NatInfo): + Display information of a NAT. + + This field is a member of `oneof`_ ``step_info``. + proxy_connection (google.cloud.network_management_v1.types.ProxyConnectionInfo): + Display information of a ProxyConnection. + + This field is a member of `oneof`_ ``step_info``. + load_balancer_backend_info (google.cloud.network_management_v1.types.LoadBalancerBackendInfo): + Display information of a specific load + balancer backend. + + This field is a member of `oneof`_ ``step_info``. + storage_bucket (google.cloud.network_management_v1.types.StorageBucketInfo): + Display information of a Storage Bucket. Used + only for return traces. + This field is a member of `oneof`_ ``step_info``. """ @@ -321,6 +343,9 @@ class State(proto.Enum): Config checking state: verify route. APPLY_FORWARDING_RULE (7): Config checking state: match forwarding rule. + ANALYZE_LOAD_BALANCER_BACKEND (28): + Config checking state: verify load balancer + backend configuration. SPOOFING_APPROVED (8): Config checking state: packet sent or received under foreign IP address and allowed. @@ -376,6 +401,7 @@ class State(proto.Enum): APPLY_EGRESS_FIREWALL_RULE = 5 APPLY_ROUTE = 6 APPLY_FORWARDING_RULE = 7 + ANALYZE_LOAD_BALANCER_BACKEND = 28 SPOOFING_APPROVED = 8 ARRIVE_AT_INSTANCE = 9 ARRIVE_AT_INTERNAL_LOAD_BALANCER = 10 @@ -528,6 +554,30 @@ class State(proto.Enum): oneof="step_info", message="CloudRunRevisionInfo", ) + nat: "NatInfo" = proto.Field( + proto.MESSAGE, + number=25, + oneof="step_info", + message="NatInfo", + ) + proxy_connection: "ProxyConnectionInfo" = proto.Field( + proto.MESSAGE, + number=26, + oneof="step_info", + message="ProxyConnectionInfo", + ) + load_balancer_backend_info: "LoadBalancerBackendInfo" = proto.Field( + proto.MESSAGE, + number=27, + oneof="step_info", + message="LoadBalancerBackendInfo", + ) + storage_bucket: "StorageBucketInfo" = proto.Field( + proto.MESSAGE, + number=28, + oneof="step_info", + message="StorageBucketInfo", + ) class InstanceInfo(proto.Message): @@ -1470,6 +1520,8 @@ class Target(proto.Enum): SERVERLESS_NEG (9): Target is a serverless network endpoint group. + STORAGE_BUCKET (10): + Target is a Cloud Storage bucket. """ TARGET_UNSPECIFIED = 0 INSTANCE = 1 @@ -1481,6 +1533,7 @@ class Target(proto.Enum): PSC_GOOGLE_API = 7 PSC_VPC_SC = 8 SERVERLESS_NEG = 9 + STORAGE_BUCKET = 10 target: Target = proto.Field( proto.ENUM, @@ -2116,4 +2169,344 @@ class VpcConnectorInfo(proto.Message): ) +class NatInfo(proto.Message): + r"""For display only. Metadata associated with NAT. + + Attributes: + type_ (google.cloud.network_management_v1.types.NatInfo.Type): + Type of NAT. + protocol (str): + IP protocol in string format, for example: + "TCP", "UDP", "ICMP". + network_uri (str): + URI of the network where NAT translation + takes place. + old_source_ip (str): + Source IP address before NAT translation. + new_source_ip (str): + Source IP address after NAT translation. + old_destination_ip (str): + Destination IP address before NAT + translation. + new_destination_ip (str): + Destination IP address after NAT translation. + old_source_port (int): + Source port before NAT translation. Only + valid when protocol is TCP or UDP. + new_source_port (int): + Source port after NAT translation. Only valid + when protocol is TCP or UDP. + old_destination_port (int): + Destination port before NAT translation. Only + valid when protocol is TCP or UDP. + new_destination_port (int): + Destination port after NAT translation. Only + valid when protocol is TCP or UDP. + router_uri (str): + Uri of the Cloud Router. Only valid when type is CLOUD_NAT. + nat_gateway_name (str): + The name of Cloud NAT Gateway. Only valid when type is + CLOUD_NAT. + """ + + class Type(proto.Enum): + r"""Types of NAT. + + Values: + TYPE_UNSPECIFIED (0): + Type is unspecified. + INTERNAL_TO_EXTERNAL (1): + From Compute Engine instance's internal + address to external address. + EXTERNAL_TO_INTERNAL (2): + From Compute Engine instance's external + address to internal address. + CLOUD_NAT (3): + Cloud NAT Gateway. + PRIVATE_SERVICE_CONNECT (4): + Private service connect NAT. + """ + TYPE_UNSPECIFIED = 0 + INTERNAL_TO_EXTERNAL = 1 + EXTERNAL_TO_INTERNAL = 2 + CLOUD_NAT = 3 + PRIVATE_SERVICE_CONNECT = 4 + + type_: Type = proto.Field( + proto.ENUM, + number=1, + enum=Type, + ) + protocol: str = proto.Field( + proto.STRING, + number=2, + ) + network_uri: str = proto.Field( + proto.STRING, + number=3, + ) + old_source_ip: str = proto.Field( + proto.STRING, + number=4, + ) + new_source_ip: str = proto.Field( + proto.STRING, + number=5, + ) + old_destination_ip: str = proto.Field( + proto.STRING, + number=6, + ) + new_destination_ip: str = proto.Field( + proto.STRING, + number=7, + ) + old_source_port: int = proto.Field( + proto.INT32, + number=8, + ) + new_source_port: int = proto.Field( + proto.INT32, + number=9, + ) + old_destination_port: int = proto.Field( + proto.INT32, + number=10, + ) + new_destination_port: int = proto.Field( + proto.INT32, + number=11, + ) + router_uri: str = proto.Field( + proto.STRING, + number=12, + ) + nat_gateway_name: str = proto.Field( + proto.STRING, + number=13, + ) + + +class ProxyConnectionInfo(proto.Message): + r"""For display only. Metadata associated with ProxyConnection. + + Attributes: + protocol (str): + IP protocol in string format, for example: + "TCP", "UDP", "ICMP". + old_source_ip (str): + Source IP address of an original connection. + new_source_ip (str): + Source IP address of a new connection. + old_destination_ip (str): + Destination IP address of an original + connection + new_destination_ip (str): + Destination IP address of a new connection. + old_source_port (int): + Source port of an original connection. Only + valid when protocol is TCP or UDP. + new_source_port (int): + Source port of a new connection. Only valid + when protocol is TCP or UDP. + old_destination_port (int): + Destination port of an original connection. + Only valid when protocol is TCP or UDP. + new_destination_port (int): + Destination port of a new connection. Only + valid when protocol is TCP or UDP. + subnet_uri (str): + Uri of proxy subnet. + network_uri (str): + URI of the network where connection is + proxied. + """ + + protocol: str = proto.Field( + proto.STRING, + number=1, + ) + old_source_ip: str = proto.Field( + proto.STRING, + number=2, + ) + new_source_ip: str = proto.Field( + proto.STRING, + number=3, + ) + old_destination_ip: str = proto.Field( + proto.STRING, + number=4, + ) + new_destination_ip: str = proto.Field( + proto.STRING, + number=5, + ) + old_source_port: int = proto.Field( + proto.INT32, + number=6, + ) + new_source_port: int = proto.Field( + proto.INT32, + number=7, + ) + old_destination_port: int = proto.Field( + proto.INT32, + number=8, + ) + new_destination_port: int = proto.Field( + proto.INT32, + number=9, + ) + subnet_uri: str = proto.Field( + proto.STRING, + number=10, + ) + network_uri: str = proto.Field( + proto.STRING, + number=11, + ) + + +class LoadBalancerBackendInfo(proto.Message): + r"""For display only. Metadata associated with the load balancer + backend. + + Attributes: + name (str): + Display name of the backend. For example, it + might be an instance name for the instance group + backends, or an IP address and port for zonal + network endpoint group backends. + instance_uri (str): + URI of the backend instance (if applicable). + Populated for instance group backends, and zonal + NEG backends. + backend_service_uri (str): + URI of the backend service this backend + belongs to (if applicable). + instance_group_uri (str): + URI of the instance group this backend + belongs to (if applicable). + network_endpoint_group_uri (str): + URI of the network endpoint group this + backend belongs to (if applicable). + backend_bucket_uri (str): + URI of the backend bucket this backend + targets (if applicable). + psc_service_attachment_uri (str): + URI of the PSC service attachment this PSC + NEG backend targets (if applicable). + psc_google_api_target (str): + PSC Google API target this PSC NEG backend + targets (if applicable). + health_check_uri (str): + URI of the health check attached to this + backend (if applicable). + health_check_firewalls_config_state (google.cloud.network_management_v1.types.LoadBalancerBackendInfo.HealthCheckFirewallsConfigState): + Health check firewalls configuration state + for the backend. This is a result of the static + firewall analysis (verifying that health check + traffic from required IP ranges to the backend + is allowed or not). The backend might still be + unhealthy even if these firewalls are + configured. Please refer to the documentation + for more information: + + https://cloud.google.com/load-balancing/docs/firewall-rules + """ + + class HealthCheckFirewallsConfigState(proto.Enum): + r"""Health check firewalls configuration state enum. + + Values: + HEALTH_CHECK_FIREWALLS_CONFIG_STATE_UNSPECIFIED (0): + Configuration state unspecified. It usually + means that the backend has no health check + attached, or there was an unexpected + configuration error preventing Connectivity + tests from verifying health check configuration. + FIREWALLS_CONFIGURED (1): + Firewall rules (policies) allowing health + check traffic from all required IP ranges to the + backend are configured. + FIREWALLS_PARTIALLY_CONFIGURED (2): + Firewall rules (policies) allow health check + traffic only from a part of required IP ranges. + FIREWALLS_NOT_CONFIGURED (3): + Firewall rules (policies) deny health check + traffic from all required IP ranges to the + backend. + FIREWALLS_UNSUPPORTED (4): + The network contains firewall rules of + unsupported types, so Connectivity tests were + not able to verify health check configuration + status. Please refer to the documentation for + the list of unsupported configurations: + + https://cloud.google.com/network-intelligence-center/docs/connectivity-tests/concepts/overview#unsupported-configs + """ + HEALTH_CHECK_FIREWALLS_CONFIG_STATE_UNSPECIFIED = 0 + FIREWALLS_CONFIGURED = 1 + FIREWALLS_PARTIALLY_CONFIGURED = 2 + FIREWALLS_NOT_CONFIGURED = 3 + FIREWALLS_UNSUPPORTED = 4 + + name: str = proto.Field( + proto.STRING, + number=1, + ) + instance_uri: str = proto.Field( + proto.STRING, + number=2, + ) + backend_service_uri: str = proto.Field( + proto.STRING, + number=3, + ) + instance_group_uri: str = proto.Field( + proto.STRING, + number=4, + ) + network_endpoint_group_uri: str = proto.Field( + proto.STRING, + number=5, + ) + backend_bucket_uri: str = proto.Field( + proto.STRING, + number=8, + ) + psc_service_attachment_uri: str = proto.Field( + proto.STRING, + number=9, + ) + psc_google_api_target: str = proto.Field( + proto.STRING, + number=10, + ) + health_check_uri: str = proto.Field( + proto.STRING, + number=6, + ) + health_check_firewalls_config_state: HealthCheckFirewallsConfigState = proto.Field( + proto.ENUM, + number=7, + enum=HealthCheckFirewallsConfigState, + ) + + +class StorageBucketInfo(proto.Message): + r"""For display only. Metadata associated with Storage Bucket. + + Attributes: + bucket (str): + Cloud Storage Bucket name. + """ + + bucket: str = proto.Field( + proto.STRING, + number=1, + ) + + __all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/packages/google-cloud-network-management/tests/unit/gapic/network_management_v1/test_reachability_service.py b/packages/google-cloud-network-management/tests/unit/gapic/network_management_v1/test_reachability_service.py index cc4f3b9edbd8..646a77ff60e7 100644 --- a/packages/google-cloud-network-management/tests/unit/gapic/network_management_v1/test_reachability_service.py +++ b/packages/google-cloud-network-management/tests/unit/gapic/network_management_v1/test_reachability_service.py @@ -3693,6 +3693,47 @@ def test_create_connectivity_test_rest(request_type): "location": "location_value", "service_uri": "service_uri_value", }, + "nat": { + "type_": 1, + "protocol": "protocol_value", + "network_uri": "network_uri_value", + "old_source_ip": "old_source_ip_value", + "new_source_ip": "new_source_ip_value", + "old_destination_ip": "old_destination_ip_value", + "new_destination_ip": "new_destination_ip_value", + "old_source_port": 1619, + "new_source_port": 1630, + "old_destination_port": 2148, + "new_destination_port": 2159, + "router_uri": "router_uri_value", + "nat_gateway_name": "nat_gateway_name_value", + }, + "proxy_connection": { + "protocol": "protocol_value", + "old_source_ip": "old_source_ip_value", + "new_source_ip": "new_source_ip_value", + "old_destination_ip": "old_destination_ip_value", + "new_destination_ip": "new_destination_ip_value", + "old_source_port": 1619, + "new_source_port": 1630, + "old_destination_port": 2148, + "new_destination_port": 2159, + "subnet_uri": "subnet_uri_value", + "network_uri": "network_uri_value", + }, + "load_balancer_backend_info": { + "name": "name_value", + "instance_uri": "instance_uri_value", + "backend_service_uri": "backend_service_uri_value", + "instance_group_uri": "instance_group_uri_value", + "network_endpoint_group_uri": "network_endpoint_group_uri_value", + "backend_bucket_uri": "backend_bucket_uri_value", + "psc_service_attachment_uri": "psc_service_attachment_uri_value", + "psc_google_api_target": "psc_google_api_target_value", + "health_check_uri": "health_check_uri_value", + "health_check_firewalls_config_state": 1, + }, + "storage_bucket": {"bucket": "bucket_value"}, } ], } @@ -4302,6 +4343,47 @@ def test_update_connectivity_test_rest(request_type): "location": "location_value", "service_uri": "service_uri_value", }, + "nat": { + "type_": 1, + "protocol": "protocol_value", + "network_uri": "network_uri_value", + "old_source_ip": "old_source_ip_value", + "new_source_ip": "new_source_ip_value", + "old_destination_ip": "old_destination_ip_value", + "new_destination_ip": "new_destination_ip_value", + "old_source_port": 1619, + "new_source_port": 1630, + "old_destination_port": 2148, + "new_destination_port": 2159, + "router_uri": "router_uri_value", + "nat_gateway_name": "nat_gateway_name_value", + }, + "proxy_connection": { + "protocol": "protocol_value", + "old_source_ip": "old_source_ip_value", + "new_source_ip": "new_source_ip_value", + "old_destination_ip": "old_destination_ip_value", + "new_destination_ip": "new_destination_ip_value", + "old_source_port": 1619, + "new_source_port": 1630, + "old_destination_port": 2148, + "new_destination_port": 2159, + "subnet_uri": "subnet_uri_value", + "network_uri": "network_uri_value", + }, + "load_balancer_backend_info": { + "name": "name_value", + "instance_uri": "instance_uri_value", + "backend_service_uri": "backend_service_uri_value", + "instance_group_uri": "instance_group_uri_value", + "network_endpoint_group_uri": "network_endpoint_group_uri_value", + "backend_bucket_uri": "backend_bucket_uri_value", + "psc_service_attachment_uri": "psc_service_attachment_uri_value", + "psc_google_api_target": "psc_google_api_target_value", + "health_check_uri": "health_check_uri_value", + "health_check_firewalls_config_state": 1, + }, + "storage_bucket": {"bucket": "bucket_value"}, } ], }