From a71d871e056dff4eb5ea18ca8977636f6ff4a9d4 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Wed, 25 Jan 2023 12:23:22 -0800 Subject: [PATCH] fix(network-connectivity)!: remove policy-based routing (#3885) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix(network-connectivity)!: remove policy-based routing PiperOrigin-RevId: 504360042 Source-Link: https://github.com/googleapis/googleapis/commit/f6427904e82d032dc58ead51662108ff824b75ca Source-Link: https://github.com/googleapis/googleapis-gen/commit/91163ea61de47bda6d30d2dee4a49be27b60aa33 Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLW5ldHdvcmtjb25uZWN0aXZpdHkvLk93bEJvdC55YW1sIiwiaCI6IjkxMTYzZWE2MWRlNDdiZGE2ZDMwZDJkZWU0YTQ5YmUyN2I2MGFhMzMifQ== * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * chore: delete remaining policy based routing files * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md Co-authored-by: Owl Bot Co-authored-by: sofisl <55454395+sofisl@users.noreply.github.com> Co-authored-by: Sofia Leon --- .../cloud/networkconnectivity/v1/common.proto | 9 - .../cloud/networkconnectivity/v1/hub.proto | 266 +- .../v1/policy_based_routing.proto | 338 - .../protos/protos.d.ts | 2021 ++---- .../protos/protos.js | 5427 ++++------------- .../protos/protos.json | 630 +- .../generated/v1/hub_service.create_hub.js | 10 +- .../generated/v1/hub_service.create_spoke.js | 10 +- .../generated/v1/hub_service.delete_hub.js | 10 +- .../generated/v1/hub_service.delete_spoke.js | 10 +- .../generated/v1/hub_service.update_hub.js | 20 +- .../generated/v1/hub_service.update_spoke.js | 14 +- ...a.google.cloud.networkconnectivity.v1.json | 212 +- .../src/index.ts | 11 +- .../src/v1/gapic_metadata.json | 58 - .../src/v1/hub_service_client.ts | 602 +- .../src/v1/hub_service_proto_list.json | 3 +- .../src/v1/index.ts | 1 - .../v1/policy_based_routing_service_client.ts | 1768 ------ ...y_based_routing_service_client_config.json | 58 - ...licy_based_routing_service_proto_list.json | 5 - .../system-test/fixtures/sample/src/index.js | 2 - .../system-test/fixtures/sample/src/index.ts | 13 +- .../test/gapic_hub_service_v1.ts | 903 +-- .../gapic_policy_based_routing_service_v1.ts | 2322 ------- 25 files changed, 1765 insertions(+), 12958 deletions(-) delete mode 100644 packages/google-cloud-networkconnectivity/protos/google/cloud/networkconnectivity/v1/policy_based_routing.proto delete mode 100644 packages/google-cloud-networkconnectivity/src/v1/policy_based_routing_service_client.ts delete mode 100644 packages/google-cloud-networkconnectivity/src/v1/policy_based_routing_service_client_config.json delete mode 100644 packages/google-cloud-networkconnectivity/src/v1/policy_based_routing_service_proto_list.json delete mode 100644 packages/google-cloud-networkconnectivity/test/gapic_policy_based_routing_service_v1.ts diff --git a/packages/google-cloud-networkconnectivity/protos/google/cloud/networkconnectivity/v1/common.proto b/packages/google-cloud-networkconnectivity/protos/google/cloud/networkconnectivity/v1/common.proto index 282cf34758e..21999d592d0 100644 --- a/packages/google-cloud-networkconnectivity/protos/google/cloud/networkconnectivity/v1/common.proto +++ b/packages/google-cloud-networkconnectivity/protos/google/cloud/networkconnectivity/v1/common.proto @@ -17,7 +17,6 @@ syntax = "proto3"; package google.cloud.networkconnectivity.v1; import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; import "google/protobuf/timestamp.proto"; option csharp_namespace = "Google.Cloud.NetworkConnectivity.V1"; @@ -27,14 +26,6 @@ option java_outer_classname = "CommonProto"; option java_package = "com.google.cloud.networkconnectivity.v1"; option php_namespace = "Google\\Cloud\\NetworkConnectivity\\V1"; option ruby_package = "Google::Cloud::NetworkConnectivity::V1"; -option (google.api.resource_definition) = { - type: "compute.googleapis.com/InterconnectAttachment" - pattern: "projects/{project}/regions/{region}/interconnectAttachments/{resource_id}" -}; -option (google.api.resource_definition) = { - type: "compute.googleapis.com/Network" - pattern: "projects/{project}/global/networks/{resource_id}" -}; // Represents the metadata of the long-running operation. message OperationMetadata { diff --git a/packages/google-cloud-networkconnectivity/protos/google/cloud/networkconnectivity/v1/hub.proto b/packages/google-cloud-networkconnectivity/protos/google/cloud/networkconnectivity/v1/hub.proto index 44cf09ae0a6..c28ca9a0770 100644 --- a/packages/google-cloud-networkconnectivity/protos/google/cloud/networkconnectivity/v1/hub.proto +++ b/packages/google-cloud-networkconnectivity/protos/google/cloud/networkconnectivity/v1/hub.proto @@ -35,20 +35,27 @@ option (google.api.resource_definition) = { type: "compute.googleapis.com/VpnTunnel" pattern: "projects/{project}/regions/{region}/vpnTunnels/{resource_id}" }; +option (google.api.resource_definition) = { + type: "compute.googleapis.com/InterconnectAttachment" + pattern: "projects/{project}/regions/{region}/interconnectAttachments/{resource_id}" +}; option (google.api.resource_definition) = { type: "compute.googleapis.com/Instance" pattern: "projects/{project}/zones/{zone}/instances/{instance}" }; +option (google.api.resource_definition) = { + type: "compute.googleapis.com/Network" + pattern: "projects/{project}/global/networks/{resource_id}" +}; // Network Connectivity Center is a hub-and-spoke abstraction for network // connectivity management in Google Cloud. It reduces operational complexity // through a simple, centralized connectivity management model. service HubService { option (google.api.default_host) = "networkconnectivity.googleapis.com"; - option (google.api.oauth_scopes) = - "https://www.googleapis.com/auth/cloud-platform"; + option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/cloud-platform"; - // Lists the Network Connectivity Center hubs associated with a given project. + // Lists hubs in a given project. rpc ListHubs(ListHubsRequest) returns (ListHubsResponse) { option (google.api.http) = { get: "/v1/{parent=projects/*/locations/global}/hubs" @@ -56,7 +63,7 @@ service HubService { option (google.api.method_signature) = "parent"; } - // Gets details about a Network Connectivity Center hub. + // Gets details about the specified hub. rpc GetHub(GetHubRequest) returns (Hub) { option (google.api.http) = { get: "/v1/{name=projects/*/locations/global/hubs/*}" @@ -64,7 +71,7 @@ service HubService { option (google.api.method_signature) = "name"; } - // Creates a new Network Connectivity Center hub in the specified project. + // Creates a new hub in the specified project. rpc CreateHub(CreateHubRequest) returns (google.longrunning.Operation) { option (google.api.http) = { post: "/v1/{parent=projects/*/locations/global}/hubs" @@ -77,8 +84,7 @@ service HubService { }; } - // Updates the description and/or labels of a Network Connectivity Center - // hub. + // Updates the description and/or labels of the specified hub. rpc UpdateHub(UpdateHubRequest) returns (google.longrunning.Operation) { option (google.api.http) = { patch: "/v1/{hub.name=projects/*/locations/global/hubs/*}" @@ -91,7 +97,7 @@ service HubService { }; } - // Deletes a Network Connectivity Center hub. + // Deletes the specified hub. rpc DeleteHub(DeleteHubRequest) returns (google.longrunning.Operation) { option (google.api.http) = { delete: "/v1/{name=projects/*/locations/global/hubs/*}" @@ -103,8 +109,7 @@ service HubService { }; } - // Lists the Network Connectivity Center spokes in a specified project and - // location. + // Lists the spokes in the specified project and location. rpc ListSpokes(ListSpokesRequest) returns (ListSpokesResponse) { option (google.api.http) = { get: "/v1/{parent=projects/*/locations/*}/spokes" @@ -112,7 +117,7 @@ service HubService { option (google.api.method_signature) = "parent"; } - // Gets details about a Network Connectivity Center spoke. + // Gets details about the specified spoke. rpc GetSpoke(GetSpokeRequest) returns (Spoke) { option (google.api.http) = { get: "/v1/{name=projects/*/locations/*/spokes/*}" @@ -120,7 +125,7 @@ service HubService { option (google.api.method_signature) = "name"; } - // Creates a Network Connectivity Center spoke. + // Creates a spoke in the specified project and location. rpc CreateSpoke(CreateSpokeRequest) returns (google.longrunning.Operation) { option (google.api.http) = { post: "/v1/{parent=projects/*/locations/*}/spokes" @@ -133,7 +138,7 @@ service HubService { }; } - // Updates the parameters of a Network Connectivity Center spoke. + // Updates the parameters of the specified spoke. rpc UpdateSpoke(UpdateSpokeRequest) returns (google.longrunning.Operation) { option (google.api.http) = { patch: "/v1/{spoke.name=projects/*/locations/*/spokes/*}" @@ -146,7 +151,7 @@ service HubService { }; } - // Deletes a Network Connectivity Center spoke. + // Deletes the specified spoke. rpc DeleteSpoke(DeleteSpokeRequest) returns (google.longrunning.Operation) { option (google.api.http) = { delete: "/v1/{name=projects/*/locations/*/spokes/*}" @@ -159,18 +164,6 @@ service HubService { } } -// Supported features for a location -enum LocationFeature { - // No publicly supported feature in this location - LOCATION_FEATURE_UNSPECIFIED = 0; - - // Site-to-cloud spokes are supported in this location - SITE_TO_CLOUD_SPOKES = 1; - - // Site-to-site spokes are supported in this location - SITE_TO_SITE_SPOKES = 2; -} - // The State enum represents the lifecycle stage of a Network Connectivity // Center resource. enum State { @@ -185,16 +178,25 @@ enum State { // The resource's Delete operation is in progress DELETING = 3; +} - // The resource's Update operation is in progress - UPDATING = 6; +// Supported features for a location +enum LocationFeature { + // No publicly supported feature in this location + LOCATION_FEATURE_UNSPECIFIED = 0; + + // Site-to-cloud spokes are supported in this location + SITE_TO_CLOUD_SPOKES = 1; + + // Site-to-site spokes are supported in this location + SITE_TO_SITE_SPOKES = 2; } -// A Network Connectivity Center hub is a collection of spokes. A single hub -// can contain spokes from multiple regions. However, if any of a hub's spokes -// use the data transfer feature, the resources associated with those spokes -// must all reside in the same VPC network. Spokes that do not use data -// transfer can be associated with any VPC network in your project. +// A hub is a collection of spokes. A single hub can contain spokes from +// multiple regions. However, if any of a hub's spokes use the data transfer +// feature, the resources associated with those spokes must all reside in the +// same VPC network. Spokes that do not use data transfer can be associated +// with any VPC network in your project. message Hub { option (google.api.resource) = { type: "networkconnectivity.googleapis.com/Hub" @@ -207,12 +209,10 @@ message Hub { string name = 1 [(google.api.field_behavior) = IMMUTABLE]; // Output only. The time the hub was created. - google.protobuf.Timestamp create_time = 2 - [(google.api.field_behavior) = OUTPUT_ONLY]; + google.protobuf.Timestamp create_time = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; // Output only. The time the hub was last updated. - google.protobuf.Timestamp update_time = 3 - [(google.api.field_behavior) = OUTPUT_ONLY]; + google.protobuf.Timestamp update_time = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; // Optional labels in key:value format. For more information about labels, see // [Requirements for @@ -222,9 +222,9 @@ message Hub { // An optional description of the hub. string description = 5; - // Output only. The Google-generated UUID for the hub. This value is unique - // across all hub resources. If a hub is deleted and another with the same - // name is created, the new hub is assigned a different unique_id. + // Output only. The Google-generated UUID for the hub. This value is unique across all hub + // resources. If a hub is deleted and another with the same name is created, + // the new hub is assigned a different unique_id. string unique_id = 8 [(google.api.field_behavior) = OUTPUT_ONLY]; // Output only. The current lifecycle state of this hub. @@ -237,25 +237,24 @@ message Hub { repeated RoutingVPC routing_vpcs = 10; } -// RoutingVPC contains information about the VPC networks associated -// with the spokes of a Network Connectivity Center hub. +// RoutingVPC contains information about the VPC networks that are associated +// with a hub's spokes. message RoutingVPC { // The URI of the VPC network. - string uri = 1 [ - (google.api.resource_reference) = { type: "compute.googleapis.com/Network" } - ]; + string uri = 1 [(google.api.resource_reference) = { + type: "compute.googleapis.com/Network" + }]; - // Output only. If true, indicates that this VPC network is currently - // associated with spokes that use the data transfer feature (spokes where the + // Output only. If true, indicates that this VPC network is currently associated with + // spokes that use the data transfer feature (spokes where the // site_to_site_data_transfer field is set to true). If you create new spokes // that use data transfer, they must be associated with this VPC network. At // most, one VPC network will have this field set to true. - bool required_for_new_site_to_site_data_transfer_spokes = 2 - [(google.api.field_behavior) = OUTPUT_ONLY]; + bool required_for_new_site_to_site_data_transfer_spokes = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; } -// A Network Connectivity Center spoke represents a connection between your -// Google Cloud network resources and a non-Google-Cloud network. +// A spoke represents a connection between your Google Cloud network resources +// and a non-Google-Cloud network. // // When you create a spoke, you associate it with a hub. You must also identify // a value for exactly one of the following fields: @@ -275,12 +274,10 @@ message Spoke { string name = 1 [(google.api.field_behavior) = IMMUTABLE]; // Output only. The time the spoke was created. - google.protobuf.Timestamp create_time = 2 - [(google.api.field_behavior) = OUTPUT_ONLY]; + google.protobuf.Timestamp create_time = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; // Output only. The time the spoke was last updated. - google.protobuf.Timestamp update_time = 3 - [(google.api.field_behavior) = OUTPUT_ONLY]; + google.protobuf.Timestamp update_time = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; // Optional labels in key:value format. For more information about labels, see // [Requirements for @@ -307,18 +304,16 @@ message Spoke { // Router appliance instances that are associated with the spoke. LinkedRouterApplianceInstances linked_router_appliance_instances = 19; - // Output only. The Google-generated UUID for the spoke. This value is unique - // across all spoke resources. If a spoke is deleted and another with the same - // name is created, the new spoke is assigned a different unique_id. + // Output only. The Google-generated UUID for the spoke. This value is unique across all + // spoke resources. If a spoke is deleted and another with the same name is + // created, the new spoke is assigned a different unique_id. string unique_id = 11 [(google.api.field_behavior) = OUTPUT_ONLY]; // Output only. The current lifecycle state of this spoke. State state = 15 [(google.api.field_behavior) = OUTPUT_ONLY]; } -// Request for -// [HubService.ListHubs][google.cloud.networkconnectivity.v1.HubService.ListHubs] -// method. +// Request for [HubService.ListHubs][google.cloud.networkconnectivity.v1.HubService.ListHubs] method. message ListHubsRequest { // Required. The parent resource's name. string parent = 1 [ @@ -341,9 +336,7 @@ message ListHubsRequest { string order_by = 5; } -// Response for -// [HubService.ListHubs][google.cloud.networkconnectivity.v1.HubService.ListHubs] -// method. +// Response for [HubService.ListHubs][google.cloud.networkconnectivity.v1.HubService.ListHubs] method. message ListHubsResponse { // The requested hubs. repeated Hub hubs = 1; @@ -356,9 +349,7 @@ message ListHubsResponse { repeated string unreachable = 3; } -// Request for -// [HubService.GetHub][google.cloud.networkconnectivity.v1.HubService.GetHub] -// method. +// Request for [HubService.GetHub][google.cloud.networkconnectivity.v1.HubService.GetHub] method. message GetHubRequest { // Required. The name of the hub resource to get. string name = 1 [ @@ -369,9 +360,7 @@ message GetHubRequest { ]; } -// Request for -// [HubService.CreateHub][google.cloud.networkconnectivity.v1.HubService.CreateHub] -// method. +// Request for [HubService.CreateHub][google.cloud.networkconnectivity.v1.HubService.CreateHub] method. message CreateHubRequest { // Required. The parent resource. string parent = 1 [ @@ -387,11 +376,11 @@ message CreateHubRequest { // Required. The initial values for a new hub. Hub hub = 3 [(google.api.field_behavior) = REQUIRED]; - // Optional. A unique request ID (optional). If you specify this ID, you can - // use it in cases when you need to retry your request. When you need to - // retry, this ID lets the server know that it can ignore the request if it - // has already been completed. The server guarantees that for at least 60 - // minutes after the first request. + // Optional. A unique request ID (optional). If you specify this ID, you can use it + // in cases when you need to retry your request. When you need to retry, this + // ID lets the server know that it can ignore the request if it has already + // been completed. The server guarantees that for at least 60 minutes after + // the first request. // // For example, consider a situation where you make an initial request and // the request times out. If you make the request again with the same request @@ -404,26 +393,23 @@ message CreateHubRequest { string request_id = 4 [(google.api.field_behavior) = OPTIONAL]; } -// Request for -// [HubService.UpdateHub][google.cloud.networkconnectivity.v1.HubService.UpdateHub] -// method. +// Request for [HubService.UpdateHub][google.cloud.networkconnectivity.v1.HubService.UpdateHub] method. message UpdateHubRequest { - // Optional. In the case of an update to an existing hub, field mask is used - // to specify the fields to be overwritten. The fields specified in the - // update_mask are relative to the resource, not the full request. A field is - // overwritten if it is in the mask. If the user does not provide a mask, then - // all fields are overwritten. - google.protobuf.FieldMask update_mask = 1 - [(google.api.field_behavior) = OPTIONAL]; + // Optional. In the case of an update to an existing hub, field mask is used to specify + // the fields to be overwritten. The fields specified in the update_mask are + // relative to the resource, not the full request. A field is overwritten if + // it is in the mask. If the user does not provide a mask, then all fields are + // overwritten. + google.protobuf.FieldMask update_mask = 1 [(google.api.field_behavior) = OPTIONAL]; // Required. The state that the hub should be in after the update. Hub hub = 2 [(google.api.field_behavior) = REQUIRED]; - // Optional. A unique request ID (optional). If you specify this ID, you can - // use it in cases when you need to retry your request. When you need to - // retry, this ID lets the server know that it can ignore the request if it - // has already been completed. The server guarantees that for at least 60 - // minutes after the first request. + // Optional. A unique request ID (optional). If you specify this ID, you can use it + // in cases when you need to retry your request. When you need to retry, this + // ID lets the server know that it can ignore the request if it has already + // been completed. The server guarantees that for at least 60 minutes after + // the first request. // // For example, consider a situation where you make an initial request and // the request times out. If you make the request again with the same request @@ -436,8 +422,7 @@ message UpdateHubRequest { string request_id = 3 [(google.api.field_behavior) = OPTIONAL]; } -// The request for -// [HubService.DeleteHub][google.cloud.networkconnectivity.v1.HubService.DeleteHub]. +// The request for [HubService.DeleteHub][google.cloud.networkconnectivity.v1.HubService.DeleteHub]. message DeleteHubRequest { // Required. The name of the hub to delete. string name = 1 [ @@ -447,11 +432,11 @@ message DeleteHubRequest { } ]; - // Optional. A unique request ID (optional). If you specify this ID, you can - // use it in cases when you need to retry your request. When you need to - // retry, this ID lets the server know that it can ignore the request if it - // has already been completed. The server guarantees that for at least 60 - // minutes after the first request. + // Optional. A unique request ID (optional). If you specify this ID, you can use it + // in cases when you need to retry your request. When you need to retry, this + // ID lets the server know that it can ignore the request if it has already + // been completed. The server guarantees that for at least 60 minutes after + // the first request. // // For example, consider a situation where you make an initial request and // the request times out. If you make the request again with the same request @@ -464,8 +449,7 @@ message DeleteHubRequest { string request_id = 2 [(google.api.field_behavior) = OPTIONAL]; } -// The request for -// [HubService.ListSpokes][google.cloud.networkconnectivity.v1.HubService.ListSpokes]. +// The request for [HubService.ListSpokes][google.cloud.networkconnectivity.v1.HubService.ListSpokes]. message ListSpokesRequest { // Required. The parent resource. string parent = 1 [ @@ -488,8 +472,7 @@ message ListSpokesRequest { string order_by = 5; } -// The response for -// [HubService.ListSpokes][google.cloud.networkconnectivity.v1.HubService.ListSpokes]. +// The response for [HubService.ListSpokes][google.cloud.networkconnectivity.v1.HubService.ListSpokes]. message ListSpokesResponse { // The requested spokes. repeated Spoke spokes = 1; @@ -502,8 +485,7 @@ message ListSpokesResponse { repeated string unreachable = 3; } -// The request for -// [HubService.GetSpoke][google.cloud.networkconnectivity.v1.HubService.GetSpoke]. +// The request for [HubService.GetSpoke][google.cloud.networkconnectivity.v1.HubService.GetSpoke]. message GetSpokeRequest { // Required. The name of the spoke resource. string name = 1 [ @@ -514,8 +496,7 @@ message GetSpokeRequest { ]; } -// The request for -// [HubService.CreateSpoke][google.cloud.networkconnectivity.v1.HubService.CreateSpoke]. +// The request for [HubService.CreateSpoke][google.cloud.networkconnectivity.v1.HubService.CreateSpoke]. message CreateSpokeRequest { // Required. The parent resource. string parent = 1 [ @@ -531,11 +512,11 @@ message CreateSpokeRequest { // Required. The initial values for a new spoke. Spoke spoke = 3 [(google.api.field_behavior) = REQUIRED]; - // Optional. A unique request ID (optional). If you specify this ID, you can - // use it in cases when you need to retry your request. When you need to - // retry, this ID lets the server know that it can ignore the request if it - // has already been completed. The server guarantees that for at least 60 - // minutes after the first request. + // Optional. A unique request ID (optional). If you specify this ID, you can use it + // in cases when you need to retry your request. When you need to retry, this + // ID lets the server know that it can ignore the request if it has already + // been completed. The server guarantees that for at least 60 minutes after + // the first request. // // For example, consider a situation where you make an initial request and // the request times out. If you make the request again with the same request @@ -548,26 +529,23 @@ message CreateSpokeRequest { string request_id = 4 [(google.api.field_behavior) = OPTIONAL]; } -// Request for -// [HubService.UpdateSpoke][google.cloud.networkconnectivity.v1.HubService.UpdateSpoke] -// method. +// Request for [HubService.UpdateSpoke][google.cloud.networkconnectivity.v1.HubService.UpdateSpoke] method. message UpdateSpokeRequest { - // Optional. In the case of an update to an existing spoke, field mask is used - // to specify the fields to be overwritten. The fields specified in the + // Optional. In the case of an update to an existing spoke, field mask is used to + // specify the fields to be overwritten. The fields specified in the // update_mask are relative to the resource, not the full request. A field is // overwritten if it is in the mask. If the user does not provide a mask, then // all fields are overwritten. - google.protobuf.FieldMask update_mask = 1 - [(google.api.field_behavior) = OPTIONAL]; + google.protobuf.FieldMask update_mask = 1 [(google.api.field_behavior) = OPTIONAL]; // Required. The state that the spoke should be in after the update. Spoke spoke = 2 [(google.api.field_behavior) = REQUIRED]; - // Optional. A unique request ID (optional). If you specify this ID, you can - // use it in cases when you need to retry your request. When you need to - // retry, this ID lets the server know that it can ignore the request if it - // has already been completed. The server guarantees that for at least 60 - // minutes after the first request. + // Optional. A unique request ID (optional). If you specify this ID, you can use it + // in cases when you need to retry your request. When you need to retry, this + // ID lets the server know that it can ignore the request if it has already + // been completed. The server guarantees that for at least 60 minutes after + // the first request. // // For example, consider a situation where you make an initial request and // the request times out. If you make the request again with the same request @@ -580,8 +558,7 @@ message UpdateSpokeRequest { string request_id = 3 [(google.api.field_behavior) = OPTIONAL]; } -// The request for -// [HubService.DeleteSpoke][google.cloud.networkconnectivity.v1.HubService.DeleteSpoke]. +// The request for [HubService.DeleteSpoke][google.cloud.networkconnectivity.v1.HubService.DeleteSpoke]. message DeleteSpokeRequest { // Required. The name of the spoke to delete. string name = 1 [ @@ -591,11 +568,11 @@ message DeleteSpokeRequest { } ]; - // Optional. A unique request ID (optional). If you specify this ID, you can - // use it in cases when you need to retry your request. When you need to - // retry, this ID lets the server know that it can ignore the request if it - // has already been completed. The server guarantees that for at least 60 - // minutes after the first request. + // Optional. A unique request ID (optional). If you specify this ID, you can use it + // in cases when you need to retry your request. When you need to retry, this + // ID lets the server know that it can ignore the request if it has already + // been completed. The server guarantees that for at least 60 minutes after + // the first request. // // For example, consider a situation where you make an initial request and // the request times out. If you make the request again with the same request @@ -615,19 +592,13 @@ message DeleteSpokeRequest { message LinkedVpnTunnels { // The URIs of linked VPN tunnel resources. repeated string uris = 1 [(google.api.resource_reference) = { - type: "compute.googleapis.com/VpnTunnel" - }]; + type: "compute.googleapis.com/VpnTunnel" + }]; // A value that controls whether site-to-site data transfer is enabled for // these resources. Data transfer is available only in [supported // locations](https://cloud.google.com/network-connectivity/docs/network-connectivity-center/concepts/locations). bool site_to_site_data_transfer = 2; - - // Output only. The VPC network where these VPN tunnels are located. - string vpc_network = 3 [ - (google.api.field_behavior) = OUTPUT_ONLY, - (google.api.resource_reference) = { type: "compute.googleapis.com/Network" } - ]; } // A collection of VLAN attachment resources. These resources should @@ -637,19 +608,13 @@ message LinkedVpnTunnels { message LinkedInterconnectAttachments { // The URIs of linked interconnect attachment resources repeated string uris = 1 [(google.api.resource_reference) = { - type: "compute.googleapis.com/InterconnectAttachment" - }]; + type: "compute.googleapis.com/InterconnectAttachment" + }]; // A value that controls whether site-to-site data transfer is enabled for // these resources. Data transfer is available only in [supported // locations](https://cloud.google.com/network-connectivity/docs/network-connectivity-center/concepts/locations). bool site_to_site_data_transfer = 2; - - // Output only. The VPC network where these VLAN attachments are located. - string vpc_network = 3 [ - (google.api.field_behavior) = OUTPUT_ONLY, - (google.api.resource_reference) = { type: "compute.googleapis.com/Network" } - ]; } // A collection of router appliance instances. If you configure multiple router @@ -664,13 +629,6 @@ message LinkedRouterApplianceInstances { // these resources. Data transfer is available only in [supported // locations](https://cloud.google.com/network-connectivity/docs/network-connectivity-center/concepts/locations). bool site_to_site_data_transfer = 2; - - // Output only. The VPC network where these router appliance instances are - // located. - string vpc_network = 3 [ - (google.api.field_behavior) = OUTPUT_ONLY, - (google.api.resource_reference) = { type: "compute.googleapis.com/Network" } - ]; } // A router appliance instance is a Compute Engine virtual machine (VM) instance @@ -680,8 +638,8 @@ message LinkedRouterApplianceInstances { message RouterApplianceInstance { // The URI of the VM. string virtual_machine = 1 [(google.api.resource_reference) = { - type: "compute.googleapis.com/Instance" - }]; + type: "compute.googleapis.com/Instance" + }]; // The IP address on the VM to use for peering. string ip_address = 3; diff --git a/packages/google-cloud-networkconnectivity/protos/google/cloud/networkconnectivity/v1/policy_based_routing.proto b/packages/google-cloud-networkconnectivity/protos/google/cloud/networkconnectivity/v1/policy_based_routing.proto deleted file mode 100644 index 74c24bd3971..00000000000 --- a/packages/google-cloud-networkconnectivity/protos/google/cloud/networkconnectivity/v1/policy_based_routing.proto +++ /dev/null @@ -1,338 +0,0 @@ -// Copyright 2022 Google LLC -// -// 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. - -syntax = "proto3"; - -package google.cloud.networkconnectivity.v1; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/longrunning/operations.proto"; -import "google/protobuf/timestamp.proto"; - -option csharp_namespace = "Google.Cloud.NetworkConnectivity.V1"; -option go_package = "google.golang.org/genproto/googleapis/cloud/networkconnectivity/v1;networkconnectivity"; -option java_multiple_files = true; -option java_outer_classname = "PolicyBasedRoutingProto"; -option java_package = "com.google.cloud.networkconnectivity.v1"; -option php_namespace = "Google\\Cloud\\NetworkConnectivity\\V1"; -option ruby_package = "Google::Cloud::NetworkConnectivity::V1"; - -// Policy-Based Routing allows GCP customers to specify flexibile routing -// policies for Layer 4 traffic traversing through the connected service. -service PolicyBasedRoutingService { - option (google.api.default_host) = "networkconnectivity.googleapis.com"; - option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/cloud-platform"; - - // Lists PolicyBasedRoutes in a given project and location. - rpc ListPolicyBasedRoutes(ListPolicyBasedRoutesRequest) returns (ListPolicyBasedRoutesResponse) { - option (google.api.http) = { - get: "/v1/{parent=projects/*/locations/global}/policyBasedRoutes" - }; - option (google.api.method_signature) = "parent"; - } - - // Gets details of a single PolicyBasedRoute. - rpc GetPolicyBasedRoute(GetPolicyBasedRouteRequest) returns (PolicyBasedRoute) { - option (google.api.http) = { - get: "/v1/{name=projects/*/locations/global/policyBasedRoutes/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Creates a new PolicyBasedRoute in a given project and location. - rpc CreatePolicyBasedRoute(CreatePolicyBasedRouteRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1/{parent=projects/*/locations/global}/policyBasedRoutes" - body: "policy_based_route" - }; - option (google.api.method_signature) = "parent,policy_based_route,policy_based_route_id"; - option (google.longrunning.operation_info) = { - response_type: "PolicyBasedRoute" - metadata_type: "OperationMetadata" - }; - } - - // Deletes a single PolicyBasedRoute. - rpc DeletePolicyBasedRoute(DeletePolicyBasedRouteRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - delete: "/v1/{name=projects/*/locations/global/policyBasedRoutes/*}" - }; - option (google.api.method_signature) = "name"; - option (google.longrunning.operation_info) = { - response_type: "google.protobuf.Empty" - metadata_type: "OperationMetadata" - }; - } -} - -// Policy Based Routes (PBR) are more powerful routes that allows GCP customers -// to route their L4 network traffic based on not just destination IP, but also -// source IP, protocol and more. A PBR always take precedence when it conflicts -// with other types of routes. -// Next id: 19 -message PolicyBasedRoute { - option (google.api.resource) = { - type: "networkconnectivity.googleapis.com/PolicyBasedRoute" - pattern: "projects/{project}/{location}/global/PolicyBasedRoutes/{policy_based_route}" - }; - - // VM instances to which this policy based route applies to. - message VirtualMachine { - // Optional. A list of VM instance tags to which this policy based route applies to. - // VM instances that have ANY of tags specified here will install this - // PBR. - repeated string tags = 1 [(google.api.field_behavior) = OPTIONAL]; - } - - // InterconnectAttachment to which this route applies to. - message InterconnectAttachment { - // Optional. Cloud region to install this policy based route on interconnect - // attachment. Use `all` to install it on all interconnect attachments. - string region = 1 [(google.api.field_behavior) = OPTIONAL]; - } - - // Filter matches L4 traffic. - message Filter { - // The internet protocol version. - enum ProtocolVersion { - // Default value. - PROTOCOL_VERSION_UNSPECIFIED = 0; - - // The PBR is for IPv4 internet protocol traffic. - IPV4 = 1; - } - - // Optional. The IP protocol that this policy based route applies to. Valid values are - // 'TCP', 'UDP', and 'ALL'. Default is 'ALL'. - string ip_protocol = 1 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The source IP range of outgoing packets that this policy based route - // applies to. Default is "0.0.0.0/0" if protocol version is IPv4. - string src_range = 2 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The destination IP range of outgoing packets that this policy based route - // applies to. Default is "0.0.0.0/0" if protocol version is IPv4. - string dest_range = 3 [(google.api.field_behavior) = OPTIONAL]; - - // Required. Internet protocol versions this policy based route applies to. For this - // version, only IPV4 is supported. - ProtocolVersion protocol_version = 6 [(google.api.field_behavior) = REQUIRED]; - } - - // Informational warning message. - message Warnings { - // Warning code for Policy Based Routing. Expect to add values in the - // future. - enum Code { - // Default value. - WARNING_UNSPECIFIED = 0; - - // The policy based route is not active and functioning. Common causes are - // the dependent network was deleted or the resource project was turned - // off. - RESOURCE_NOT_ACTIVE = 1; - - // The policy based route is being modified (e.g. created/deleted) at this - // time. - RESOURCE_BEING_MODIFIED = 2; - } - - // Output only. A warning code, if applicable. - Code code = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Metadata about this warning in key: value format. The key should provides - // more detail on the warning being returned. For example, for warnings - // where there are no results in a list request for a particular zone, this - // key might be scope and the key value might be the zone name. Other - // examples might be a key indicating a deprecated resource and a suggested - // replacement. - map data = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. A human-readable description of the warning code. - string warning_message = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; - } - - // Target specifies network endpoints to which this policy based route applies - // to. If none of the target is specified, the PBR will be installed on all - // network endpoints (e.g. VMs, VPNs, and Interconnects) in the VPC. - oneof target { - // Optional. VM instances to which this policy based route applies to. - VirtualMachine virtual_machine = 18 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The interconnect attachments to which this route applies to. - InterconnectAttachment interconnect_attachment = 9 [(google.api.field_behavior) = OPTIONAL]; - } - - oneof next_hop { - // Optional. The IP of a global access enabled L4 ILB that should be the next hop to - // handle matching packets. For this version, only next_hop_ilb_ip is - // supported. - string next_hop_ilb_ip = 12 [(google.api.field_behavior) = OPTIONAL]; - } - - // Immutable. A unique name of the resource in the form of - // `projects/{project_number}/locations/global/PolicyBasedRoutes/{policy_based_route_id}` - string name = 1 [(google.api.field_behavior) = IMMUTABLE]; - - // Output only. Time when the PolicyBasedRoute was created. - google.protobuf.Timestamp create_time = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Time when the PolicyBasedRoute was updated. - google.protobuf.Timestamp update_time = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // User-defined labels. - map labels = 4; - - // Optional. An optional description of this resource. Provide this field when you - // create the resource. - string description = 5 [(google.api.field_behavior) = OPTIONAL]; - - // Required. Fully-qualified URL of the network that this route applies to. e.g. - // projects/my-project/global/networks/my-network. - string network = 6 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "compute.googleapis.com/Network" - } - ]; - - // Required. The filter to match L4 traffic. - Filter filter = 10 [(google.api.field_behavior) = REQUIRED]; - - // Optional. The priority of this policy based route. Priority is used to break ties in - // cases where there are more than one matching policy based routes found. In - // cases where multiple policy based routes are matched, the one with the - // lowest-numbered priority value wins. The default value is 1000. The - // priority value must be from 1 to 65535, inclusive. - int32 priority = 11 [(google.api.field_behavior) = OPTIONAL]; - - // Output only. If potential misconfigurations are detected for this route, - // this field will be populated with warning messages. - repeated Warnings warnings = 14 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Server-defined fully-qualified URL for this resource. - string self_link = 15 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Type of this resource. Always networkconnectivity#policyBasedRoute for - // Policy Based Route resources. - string kind = 16 [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// Request for [PolicyBasedRouting.ListPolicyBasedRoutes][] method. -message ListPolicyBasedRoutesRequest { - // Required. The parent resource's name. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "locations.googleapis.com/Location" - } - ]; - - // The maximum number of results per page that should be returned. - int32 page_size = 2; - - // The page token. - string page_token = 3; - - // A filter expression that filters the results listed in the response. - string filter = 4; - - // Sort the results by a certain order. - string order_by = 5; -} - -// Response for [PolicyBasedRouting.ListPolicyBasedRoutes][] method. -message ListPolicyBasedRoutesResponse { - // Policy based routes to be returned. - repeated PolicyBasedRoute policy_based_routes = 1; - - // The next pagination token in the List response. It should be used as - // page_token for the following request. An empty value means no more result. - string next_page_token = 2; - - // Locations that could not be reached. - repeated string unreachable = 3; -} - -// Request for [PolicyBasedRouting.GetPolicyBasedRoute][] method. -message GetPolicyBasedRouteRequest { - // Required. Name of the PolicyBasedRoute resource to get. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "networkconnectivity.googleapis.com/PolicyBasedRoute" - } - ]; -} - -// Request for [PolicyBasedRouting.CreatePolicyBasedRoute][] method. -message CreatePolicyBasedRouteRequest { - // Required. The parent resource's name of the PolicyBasedRoute. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "locations.googleapis.com/Location" - } - ]; - - // Optional. Unique id for the Policy Based Route to create. - string policy_based_route_id = 2 [(google.api.field_behavior) = OPTIONAL]; - - // Required. Initial values for a new Policy Based Route. - PolicyBasedRoute policy_based_route = 3 [(google.api.field_behavior) = REQUIRED]; - - // Optional. An optional request ID to identify requests. Specify a unique request ID - // so that if you must retry your request, the server will know to ignore - // the request if it has already been completed. The server will guarantee - // that for at least 60 minutes since the first request. - // - // For example, consider a situation where you make an initial request and t - // he request times out. If you make the request again with the same request - // ID, the server can check if original operation with the same request ID - // was received, and if so, will ignore the second request. This prevents - // clients from accidentally creating duplicate commitments. - // - // The request ID must be a valid UUID with the exception that zero UUID is - // not supported (00000000-0000-0000-0000-000000000000). - string request_id = 4 [(google.api.field_behavior) = OPTIONAL]; -} - -// Request for [PolicyBasedRouting.DeletePolicyBasedRoute][] method. -message DeletePolicyBasedRouteRequest { - // Required. Name of the PolicyBasedRoute resource to delete. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "networkconnectivity.googleapis.com/PolicyBasedRoute" - } - ]; - - // Optional. An optional request ID to identify requests. Specify a unique request ID - // so that if you must retry your request, the server will know to ignore - // the request if it has already been completed. The server will guarantee - // that for at least 60 minutes after the first request. - // - // For example, consider a situation where you make an initial request and t - // he request times out. If you make the request again with the same request - // ID, the server can check if original operation with the same request ID - // was received, and if so, will ignore the second request. This prevents - // clients from accidentally creating duplicate commitments. - // - // The request ID must be a valid UUID with the exception that zero UUID is - // not supported (00000000-0000-0000-0000-000000000000). - string request_id = 2 [(google.api.field_behavior) = OPTIONAL]; -} diff --git a/packages/google-cloud-networkconnectivity/protos/protos.d.ts b/packages/google-cloud-networkconnectivity/protos/protos.d.ts index da85e2ffadc..1a12e0cb7cb 100644 --- a/packages/google-cloud-networkconnectivity/protos/protos.d.ts +++ b/packages/google-cloud-networkconnectivity/protos/protos.d.ts @@ -393,20 +393,19 @@ export namespace google { type DeleteSpokeCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; } - /** LocationFeature enum. */ - enum LocationFeature { - LOCATION_FEATURE_UNSPECIFIED = 0, - SITE_TO_CLOUD_SPOKES = 1, - SITE_TO_SITE_SPOKES = 2 - } - /** State enum. */ enum State { STATE_UNSPECIFIED = 0, CREATING = 1, ACTIVE = 2, - DELETING = 3, - UPDATING = 6 + DELETING = 3 + } + + /** LocationFeature enum. */ + enum LocationFeature { + LOCATION_FEATURE_UNSPECIFIED = 0, + SITE_TO_CLOUD_SPOKES = 1, + SITE_TO_SITE_SPOKES = 2 } /** Properties of a Hub. */ @@ -2124,9 +2123,6 @@ export namespace google { /** LinkedVpnTunnels siteToSiteDataTransfer */ siteToSiteDataTransfer?: (boolean|null); - - /** LinkedVpnTunnels vpcNetwork */ - vpcNetwork?: (string|null); } /** Represents a LinkedVpnTunnels. */ @@ -2144,9 +2140,6 @@ export namespace google { /** LinkedVpnTunnels siteToSiteDataTransfer. */ public siteToSiteDataTransfer: boolean; - /** LinkedVpnTunnels vpcNetwork. */ - public vpcNetwork: string; - /** * Creates a new LinkedVpnTunnels instance using the specified properties. * @param [properties] Properties to set @@ -2233,9 +2226,6 @@ export namespace google { /** LinkedInterconnectAttachments siteToSiteDataTransfer */ siteToSiteDataTransfer?: (boolean|null); - - /** LinkedInterconnectAttachments vpcNetwork */ - vpcNetwork?: (string|null); } /** Represents a LinkedInterconnectAttachments. */ @@ -2253,9 +2243,6 @@ export namespace google { /** LinkedInterconnectAttachments siteToSiteDataTransfer. */ public siteToSiteDataTransfer: boolean; - /** LinkedInterconnectAttachments vpcNetwork. */ - public vpcNetwork: string; - /** * Creates a new LinkedInterconnectAttachments instance using the specified properties. * @param [properties] Properties to set @@ -2342,9 +2329,6 @@ export namespace google { /** LinkedRouterApplianceInstances siteToSiteDataTransfer */ siteToSiteDataTransfer?: (boolean|null); - - /** LinkedRouterApplianceInstances vpcNetwork */ - vpcNetwork?: (string|null); } /** Represents a LinkedRouterApplianceInstances. */ @@ -2362,9 +2346,6 @@ export namespace google { /** LinkedRouterApplianceInstances siteToSiteDataTransfer. */ public siteToSiteDataTransfer: boolean; - /** LinkedRouterApplianceInstances vpcNetwork. */ - public vpcNetwork: string; - /** * Creates a new LinkedRouterApplianceInstances instance using the specified properties. * @param [properties] Properties to set @@ -2642,1486 +2623,212 @@ export namespace google { */ public static getTypeUrl(typeUrlPrefix?: string): string; } + } - /** Represents a PolicyBasedRoutingService */ - class PolicyBasedRoutingService extends $protobuf.rpc.Service { - - /** - * Constructs a new PolicyBasedRoutingService service. - * @param rpcImpl RPC implementation - * @param [requestDelimited=false] Whether requests are length-delimited - * @param [responseDelimited=false] Whether responses are length-delimited - */ - constructor(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean); - - /** - * Creates new PolicyBasedRoutingService service using the specified rpc implementation. - * @param rpcImpl RPC implementation - * @param [requestDelimited=false] Whether requests are length-delimited - * @param [responseDelimited=false] Whether responses are length-delimited - * @returns RPC service. Useful where requests and/or responses are streamed. - */ - public static create(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean): PolicyBasedRoutingService; - - /** - * Calls ListPolicyBasedRoutes. - * @param request ListPolicyBasedRoutesRequest message or plain object - * @param callback Node-style callback called with the error, if any, and ListPolicyBasedRoutesResponse - */ - public listPolicyBasedRoutes(request: google.cloud.networkconnectivity.v1.IListPolicyBasedRoutesRequest, callback: google.cloud.networkconnectivity.v1.PolicyBasedRoutingService.ListPolicyBasedRoutesCallback): void; - - /** - * Calls ListPolicyBasedRoutes. - * @param request ListPolicyBasedRoutesRequest message or plain object - * @returns Promise - */ - public listPolicyBasedRoutes(request: google.cloud.networkconnectivity.v1.IListPolicyBasedRoutesRequest): Promise; - - /** - * Calls GetPolicyBasedRoute. - * @param request GetPolicyBasedRouteRequest message or plain object - * @param callback Node-style callback called with the error, if any, and PolicyBasedRoute - */ - public getPolicyBasedRoute(request: google.cloud.networkconnectivity.v1.IGetPolicyBasedRouteRequest, callback: google.cloud.networkconnectivity.v1.PolicyBasedRoutingService.GetPolicyBasedRouteCallback): void; - - /** - * Calls GetPolicyBasedRoute. - * @param request GetPolicyBasedRouteRequest message or plain object - * @returns Promise - */ - public getPolicyBasedRoute(request: google.cloud.networkconnectivity.v1.IGetPolicyBasedRouteRequest): Promise; - - /** - * Calls CreatePolicyBasedRoute. - * @param request CreatePolicyBasedRouteRequest message or plain object - * @param callback Node-style callback called with the error, if any, and Operation - */ - public createPolicyBasedRoute(request: google.cloud.networkconnectivity.v1.ICreatePolicyBasedRouteRequest, callback: google.cloud.networkconnectivity.v1.PolicyBasedRoutingService.CreatePolicyBasedRouteCallback): void; - - /** - * Calls CreatePolicyBasedRoute. - * @param request CreatePolicyBasedRouteRequest message or plain object - * @returns Promise - */ - public createPolicyBasedRoute(request: google.cloud.networkconnectivity.v1.ICreatePolicyBasedRouteRequest): Promise; - - /** - * Calls DeletePolicyBasedRoute. - * @param request DeletePolicyBasedRouteRequest message or plain object - * @param callback Node-style callback called with the error, if any, and Operation - */ - public deletePolicyBasedRoute(request: google.cloud.networkconnectivity.v1.IDeletePolicyBasedRouteRequest, callback: google.cloud.networkconnectivity.v1.PolicyBasedRoutingService.DeletePolicyBasedRouteCallback): void; - - /** - * Calls DeletePolicyBasedRoute. - * @param request DeletePolicyBasedRouteRequest message or plain object - * @returns Promise - */ - public deletePolicyBasedRoute(request: google.cloud.networkconnectivity.v1.IDeletePolicyBasedRouteRequest): Promise; - } - - namespace PolicyBasedRoutingService { - - /** - * Callback as used by {@link google.cloud.networkconnectivity.v1.PolicyBasedRoutingService|listPolicyBasedRoutes}. - * @param error Error, if any - * @param [response] ListPolicyBasedRoutesResponse - */ - type ListPolicyBasedRoutesCallback = (error: (Error|null), response?: google.cloud.networkconnectivity.v1.ListPolicyBasedRoutesResponse) => void; - - /** - * Callback as used by {@link google.cloud.networkconnectivity.v1.PolicyBasedRoutingService|getPolicyBasedRoute}. - * @param error Error, if any - * @param [response] PolicyBasedRoute - */ - type GetPolicyBasedRouteCallback = (error: (Error|null), response?: google.cloud.networkconnectivity.v1.PolicyBasedRoute) => void; - - /** - * Callback as used by {@link google.cloud.networkconnectivity.v1.PolicyBasedRoutingService|createPolicyBasedRoute}. - * @param error Error, if any - * @param [response] Operation - */ - type CreatePolicyBasedRouteCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; - - /** - * Callback as used by {@link google.cloud.networkconnectivity.v1.PolicyBasedRoutingService|deletePolicyBasedRoute}. - * @param error Error, if any - * @param [response] Operation - */ - type DeletePolicyBasedRouteCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; - } - - /** Properties of a PolicyBasedRoute. */ - interface IPolicyBasedRoute { - - /** PolicyBasedRoute virtualMachine */ - virtualMachine?: (google.cloud.networkconnectivity.v1.PolicyBasedRoute.IVirtualMachine|null); - - /** PolicyBasedRoute interconnectAttachment */ - interconnectAttachment?: (google.cloud.networkconnectivity.v1.PolicyBasedRoute.IInterconnectAttachment|null); - - /** PolicyBasedRoute nextHopIlbIp */ - nextHopIlbIp?: (string|null); + /** Namespace v1alpha1. */ + namespace v1alpha1 { - /** PolicyBasedRoute name */ - name?: (string|null); + /** Properties of an OperationMetadata. */ + interface IOperationMetadata { - /** PolicyBasedRoute createTime */ + /** OperationMetadata createTime */ createTime?: (google.protobuf.ITimestamp|null); - /** PolicyBasedRoute updateTime */ - updateTime?: (google.protobuf.ITimestamp|null); - - /** PolicyBasedRoute labels */ - labels?: ({ [k: string]: string }|null); - - /** PolicyBasedRoute description */ - description?: (string|null); - - /** PolicyBasedRoute network */ - network?: (string|null); + /** OperationMetadata endTime */ + endTime?: (google.protobuf.ITimestamp|null); - /** PolicyBasedRoute filter */ - filter?: (google.cloud.networkconnectivity.v1.PolicyBasedRoute.IFilter|null); + /** OperationMetadata target */ + target?: (string|null); - /** PolicyBasedRoute priority */ - priority?: (number|null); + /** OperationMetadata verb */ + verb?: (string|null); - /** PolicyBasedRoute warnings */ - warnings?: (google.cloud.networkconnectivity.v1.PolicyBasedRoute.IWarnings[]|null); + /** OperationMetadata statusMessage */ + statusMessage?: (string|null); - /** PolicyBasedRoute selfLink */ - selfLink?: (string|null); + /** OperationMetadata requestedCancellation */ + requestedCancellation?: (boolean|null); - /** PolicyBasedRoute kind */ - kind?: (string|null); + /** OperationMetadata apiVersion */ + apiVersion?: (string|null); } - /** Represents a PolicyBasedRoute. */ - class PolicyBasedRoute implements IPolicyBasedRoute { + /** Represents an OperationMetadata. */ + class OperationMetadata implements IOperationMetadata { /** - * Constructs a new PolicyBasedRoute. + * Constructs a new OperationMetadata. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.networkconnectivity.v1.IPolicyBasedRoute); - - /** PolicyBasedRoute virtualMachine. */ - public virtualMachine?: (google.cloud.networkconnectivity.v1.PolicyBasedRoute.IVirtualMachine|null); - - /** PolicyBasedRoute interconnectAttachment. */ - public interconnectAttachment?: (google.cloud.networkconnectivity.v1.PolicyBasedRoute.IInterconnectAttachment|null); - - /** PolicyBasedRoute nextHopIlbIp. */ - public nextHopIlbIp?: (string|null); - - /** PolicyBasedRoute name. */ - public name: string; + constructor(properties?: google.cloud.networkconnectivity.v1alpha1.IOperationMetadata); - /** PolicyBasedRoute createTime. */ + /** OperationMetadata createTime. */ public createTime?: (google.protobuf.ITimestamp|null); - /** PolicyBasedRoute updateTime. */ - public updateTime?: (google.protobuf.ITimestamp|null); - - /** PolicyBasedRoute labels. */ - public labels: { [k: string]: string }; - - /** PolicyBasedRoute description. */ - public description: string; - - /** PolicyBasedRoute network. */ - public network: string; - - /** PolicyBasedRoute filter. */ - public filter?: (google.cloud.networkconnectivity.v1.PolicyBasedRoute.IFilter|null); - - /** PolicyBasedRoute priority. */ - public priority: number; + /** OperationMetadata endTime. */ + public endTime?: (google.protobuf.ITimestamp|null); - /** PolicyBasedRoute warnings. */ - public warnings: google.cloud.networkconnectivity.v1.PolicyBasedRoute.IWarnings[]; + /** OperationMetadata target. */ + public target: string; - /** PolicyBasedRoute selfLink. */ - public selfLink: string; + /** OperationMetadata verb. */ + public verb: string; - /** PolicyBasedRoute kind. */ - public kind: string; + /** OperationMetadata statusMessage. */ + public statusMessage: string; - /** PolicyBasedRoute target. */ - public target?: ("virtualMachine"|"interconnectAttachment"); + /** OperationMetadata requestedCancellation. */ + public requestedCancellation: boolean; - /** PolicyBasedRoute nextHop. */ - public nextHop?: "nextHopIlbIp"; + /** OperationMetadata apiVersion. */ + public apiVersion: string; /** - * Creates a new PolicyBasedRoute instance using the specified properties. + * Creates a new OperationMetadata instance using the specified properties. * @param [properties] Properties to set - * @returns PolicyBasedRoute instance + * @returns OperationMetadata instance */ - public static create(properties?: google.cloud.networkconnectivity.v1.IPolicyBasedRoute): google.cloud.networkconnectivity.v1.PolicyBasedRoute; + public static create(properties?: google.cloud.networkconnectivity.v1alpha1.IOperationMetadata): google.cloud.networkconnectivity.v1alpha1.OperationMetadata; /** - * Encodes the specified PolicyBasedRoute message. Does not implicitly {@link google.cloud.networkconnectivity.v1.PolicyBasedRoute.verify|verify} messages. - * @param message PolicyBasedRoute message or plain object to encode + * Encodes the specified OperationMetadata message. Does not implicitly {@link google.cloud.networkconnectivity.v1alpha1.OperationMetadata.verify|verify} messages. + * @param message OperationMetadata message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.networkconnectivity.v1.IPolicyBasedRoute, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.networkconnectivity.v1alpha1.IOperationMetadata, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified PolicyBasedRoute message, length delimited. Does not implicitly {@link google.cloud.networkconnectivity.v1.PolicyBasedRoute.verify|verify} messages. - * @param message PolicyBasedRoute message or plain object to encode + * Encodes the specified OperationMetadata message, length delimited. Does not implicitly {@link google.cloud.networkconnectivity.v1alpha1.OperationMetadata.verify|verify} messages. + * @param message OperationMetadata message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.networkconnectivity.v1.IPolicyBasedRoute, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.networkconnectivity.v1alpha1.IOperationMetadata, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a PolicyBasedRoute message from the specified reader or buffer. + * Decodes an OperationMetadata message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns PolicyBasedRoute + * @returns OperationMetadata * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.networkconnectivity.v1.PolicyBasedRoute; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.networkconnectivity.v1alpha1.OperationMetadata; /** - * Decodes a PolicyBasedRoute message from the specified reader or buffer, length delimited. + * Decodes an OperationMetadata message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns PolicyBasedRoute + * @returns OperationMetadata * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.networkconnectivity.v1.PolicyBasedRoute; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.networkconnectivity.v1alpha1.OperationMetadata; /** - * Verifies a PolicyBasedRoute message. + * Verifies an OperationMetadata message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a PolicyBasedRoute message from a plain object. Also converts values to their respective internal types. + * Creates an OperationMetadata message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns PolicyBasedRoute + * @returns OperationMetadata */ - public static fromObject(object: { [k: string]: any }): google.cloud.networkconnectivity.v1.PolicyBasedRoute; + public static fromObject(object: { [k: string]: any }): google.cloud.networkconnectivity.v1alpha1.OperationMetadata; /** - * Creates a plain object from a PolicyBasedRoute message. Also converts values to other types if specified. - * @param message PolicyBasedRoute + * Creates a plain object from an OperationMetadata message. Also converts values to other types if specified. + * @param message OperationMetadata * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.networkconnectivity.v1.PolicyBasedRoute, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.networkconnectivity.v1alpha1.OperationMetadata, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this PolicyBasedRoute to JSON. + * Converts this OperationMetadata to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; /** - * Gets the default type url for PolicyBasedRoute + * Gets the default type url for OperationMetadata * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns The default type url */ public static getTypeUrl(typeUrlPrefix?: string): string; } - namespace PolicyBasedRoute { - - /** Properties of a VirtualMachine. */ - interface IVirtualMachine { - - /** VirtualMachine tags */ - tags?: (string[]|null); - } - - /** Represents a VirtualMachine. */ - class VirtualMachine implements IVirtualMachine { - - /** - * Constructs a new VirtualMachine. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.networkconnectivity.v1.PolicyBasedRoute.IVirtualMachine); - - /** VirtualMachine tags. */ - public tags: string[]; - - /** - * Creates a new VirtualMachine instance using the specified properties. - * @param [properties] Properties to set - * @returns VirtualMachine instance - */ - public static create(properties?: google.cloud.networkconnectivity.v1.PolicyBasedRoute.IVirtualMachine): google.cloud.networkconnectivity.v1.PolicyBasedRoute.VirtualMachine; - - /** - * Encodes the specified VirtualMachine message. Does not implicitly {@link google.cloud.networkconnectivity.v1.PolicyBasedRoute.VirtualMachine.verify|verify} messages. - * @param message VirtualMachine message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.networkconnectivity.v1.PolicyBasedRoute.IVirtualMachine, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified VirtualMachine message, length delimited. Does not implicitly {@link google.cloud.networkconnectivity.v1.PolicyBasedRoute.VirtualMachine.verify|verify} messages. - * @param message VirtualMachine message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.networkconnectivity.v1.PolicyBasedRoute.IVirtualMachine, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a VirtualMachine message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns VirtualMachine - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.networkconnectivity.v1.PolicyBasedRoute.VirtualMachine; - - /** - * Decodes a VirtualMachine message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns VirtualMachine - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.networkconnectivity.v1.PolicyBasedRoute.VirtualMachine; - - /** - * Verifies a VirtualMachine message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a VirtualMachine message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns VirtualMachine - */ - public static fromObject(object: { [k: string]: any }): google.cloud.networkconnectivity.v1.PolicyBasedRoute.VirtualMachine; - - /** - * Creates a plain object from a VirtualMachine message. Also converts values to other types if specified. - * @param message VirtualMachine - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.networkconnectivity.v1.PolicyBasedRoute.VirtualMachine, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this VirtualMachine to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for VirtualMachine - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of an InterconnectAttachment. */ - interface IInterconnectAttachment { - - /** InterconnectAttachment region */ - region?: (string|null); - } - - /** Represents an InterconnectAttachment. */ - class InterconnectAttachment implements IInterconnectAttachment { - - /** - * Constructs a new InterconnectAttachment. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.networkconnectivity.v1.PolicyBasedRoute.IInterconnectAttachment); - - /** InterconnectAttachment region. */ - public region: string; - - /** - * Creates a new InterconnectAttachment instance using the specified properties. - * @param [properties] Properties to set - * @returns InterconnectAttachment instance - */ - public static create(properties?: google.cloud.networkconnectivity.v1.PolicyBasedRoute.IInterconnectAttachment): google.cloud.networkconnectivity.v1.PolicyBasedRoute.InterconnectAttachment; - - /** - * Encodes the specified InterconnectAttachment message. Does not implicitly {@link google.cloud.networkconnectivity.v1.PolicyBasedRoute.InterconnectAttachment.verify|verify} messages. - * @param message InterconnectAttachment message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.networkconnectivity.v1.PolicyBasedRoute.IInterconnectAttachment, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified InterconnectAttachment message, length delimited. Does not implicitly {@link google.cloud.networkconnectivity.v1.PolicyBasedRoute.InterconnectAttachment.verify|verify} messages. - * @param message InterconnectAttachment message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.networkconnectivity.v1.PolicyBasedRoute.IInterconnectAttachment, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes an InterconnectAttachment message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns InterconnectAttachment - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.networkconnectivity.v1.PolicyBasedRoute.InterconnectAttachment; - - /** - * Decodes an InterconnectAttachment message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns InterconnectAttachment - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.networkconnectivity.v1.PolicyBasedRoute.InterconnectAttachment; - - /** - * Verifies an InterconnectAttachment message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates an InterconnectAttachment message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns InterconnectAttachment - */ - public static fromObject(object: { [k: string]: any }): google.cloud.networkconnectivity.v1.PolicyBasedRoute.InterconnectAttachment; - - /** - * Creates a plain object from an InterconnectAttachment message. Also converts values to other types if specified. - * @param message InterconnectAttachment - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.networkconnectivity.v1.PolicyBasedRoute.InterconnectAttachment, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this InterconnectAttachment to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for InterconnectAttachment - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a Filter. */ - interface IFilter { - - /** Filter ipProtocol */ - ipProtocol?: (string|null); - - /** Filter srcRange */ - srcRange?: (string|null); - - /** Filter destRange */ - destRange?: (string|null); - - /** Filter protocolVersion */ - protocolVersion?: (google.cloud.networkconnectivity.v1.PolicyBasedRoute.Filter.ProtocolVersion|keyof typeof google.cloud.networkconnectivity.v1.PolicyBasedRoute.Filter.ProtocolVersion|null); - } - - /** Represents a Filter. */ - class Filter implements IFilter { - - /** - * Constructs a new Filter. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.networkconnectivity.v1.PolicyBasedRoute.IFilter); - - /** Filter ipProtocol. */ - public ipProtocol: string; - - /** Filter srcRange. */ - public srcRange: string; - - /** Filter destRange. */ - public destRange: string; - - /** Filter protocolVersion. */ - public protocolVersion: (google.cloud.networkconnectivity.v1.PolicyBasedRoute.Filter.ProtocolVersion|keyof typeof google.cloud.networkconnectivity.v1.PolicyBasedRoute.Filter.ProtocolVersion); - - /** - * Creates a new Filter instance using the specified properties. - * @param [properties] Properties to set - * @returns Filter instance - */ - public static create(properties?: google.cloud.networkconnectivity.v1.PolicyBasedRoute.IFilter): google.cloud.networkconnectivity.v1.PolicyBasedRoute.Filter; - - /** - * Encodes the specified Filter message. Does not implicitly {@link google.cloud.networkconnectivity.v1.PolicyBasedRoute.Filter.verify|verify} messages. - * @param message Filter message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.networkconnectivity.v1.PolicyBasedRoute.IFilter, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified Filter message, length delimited. Does not implicitly {@link google.cloud.networkconnectivity.v1.PolicyBasedRoute.Filter.verify|verify} messages. - * @param message Filter message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.networkconnectivity.v1.PolicyBasedRoute.IFilter, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a Filter message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns Filter - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.networkconnectivity.v1.PolicyBasedRoute.Filter; - - /** - * Decodes a Filter message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns Filter - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.networkconnectivity.v1.PolicyBasedRoute.Filter; - - /** - * Verifies a Filter message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a Filter message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns Filter - */ - public static fromObject(object: { [k: string]: any }): google.cloud.networkconnectivity.v1.PolicyBasedRoute.Filter; - - /** - * Creates a plain object from a Filter message. Also converts values to other types if specified. - * @param message Filter - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.networkconnectivity.v1.PolicyBasedRoute.Filter, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this Filter to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for Filter - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - namespace Filter { - - /** ProtocolVersion enum. */ - enum ProtocolVersion { - PROTOCOL_VERSION_UNSPECIFIED = 0, - IPV4 = 1 - } - } - - /** Properties of a Warnings. */ - interface IWarnings { - - /** Warnings code */ - code?: (google.cloud.networkconnectivity.v1.PolicyBasedRoute.Warnings.Code|keyof typeof google.cloud.networkconnectivity.v1.PolicyBasedRoute.Warnings.Code|null); - - /** Warnings data */ - data?: ({ [k: string]: string }|null); - - /** Warnings warningMessage */ - warningMessage?: (string|null); - } - - /** Represents a Warnings. */ - class Warnings implements IWarnings { - - /** - * Constructs a new Warnings. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.networkconnectivity.v1.PolicyBasedRoute.IWarnings); - - /** Warnings code. */ - public code: (google.cloud.networkconnectivity.v1.PolicyBasedRoute.Warnings.Code|keyof typeof google.cloud.networkconnectivity.v1.PolicyBasedRoute.Warnings.Code); - - /** Warnings data. */ - public data: { [k: string]: string }; - - /** Warnings warningMessage. */ - public warningMessage: string; - - /** - * Creates a new Warnings instance using the specified properties. - * @param [properties] Properties to set - * @returns Warnings instance - */ - public static create(properties?: google.cloud.networkconnectivity.v1.PolicyBasedRoute.IWarnings): google.cloud.networkconnectivity.v1.PolicyBasedRoute.Warnings; - - /** - * Encodes the specified Warnings message. Does not implicitly {@link google.cloud.networkconnectivity.v1.PolicyBasedRoute.Warnings.verify|verify} messages. - * @param message Warnings message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.networkconnectivity.v1.PolicyBasedRoute.IWarnings, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified Warnings message, length delimited. Does not implicitly {@link google.cloud.networkconnectivity.v1.PolicyBasedRoute.Warnings.verify|verify} messages. - * @param message Warnings message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.networkconnectivity.v1.PolicyBasedRoute.IWarnings, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a Warnings message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns Warnings - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.networkconnectivity.v1.PolicyBasedRoute.Warnings; - - /** - * Decodes a Warnings message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns Warnings - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.networkconnectivity.v1.PolicyBasedRoute.Warnings; - - /** - * Verifies a Warnings message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a Warnings message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns Warnings - */ - public static fromObject(object: { [k: string]: any }): google.cloud.networkconnectivity.v1.PolicyBasedRoute.Warnings; - - /** - * Creates a plain object from a Warnings message. Also converts values to other types if specified. - * @param message Warnings - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.networkconnectivity.v1.PolicyBasedRoute.Warnings, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this Warnings to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for Warnings - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - namespace Warnings { - - /** Code enum. */ - enum Code { - WARNING_UNSPECIFIED = 0, - RESOURCE_NOT_ACTIVE = 1, - RESOURCE_BEING_MODIFIED = 2 - } - } - } - - /** Properties of a ListPolicyBasedRoutesRequest. */ - interface IListPolicyBasedRoutesRequest { - - /** ListPolicyBasedRoutesRequest parent */ - parent?: (string|null); - - /** ListPolicyBasedRoutesRequest pageSize */ - pageSize?: (number|null); - - /** ListPolicyBasedRoutesRequest pageToken */ - pageToken?: (string|null); - - /** ListPolicyBasedRoutesRequest filter */ - filter?: (string|null); - - /** ListPolicyBasedRoutesRequest orderBy */ - orderBy?: (string|null); - } - - /** Represents a ListPolicyBasedRoutesRequest. */ - class ListPolicyBasedRoutesRequest implements IListPolicyBasedRoutesRequest { + /** Represents a HubService */ + class HubService extends $protobuf.rpc.Service { /** - * Constructs a new ListPolicyBasedRoutesRequest. - * @param [properties] Properties to set + * Constructs a new HubService service. + * @param rpcImpl RPC implementation + * @param [requestDelimited=false] Whether requests are length-delimited + * @param [responseDelimited=false] Whether responses are length-delimited */ - constructor(properties?: google.cloud.networkconnectivity.v1.IListPolicyBasedRoutesRequest); - - /** ListPolicyBasedRoutesRequest parent. */ - public parent: string; - - /** ListPolicyBasedRoutesRequest pageSize. */ - public pageSize: number; - - /** ListPolicyBasedRoutesRequest pageToken. */ - public pageToken: string; - - /** ListPolicyBasedRoutesRequest filter. */ - public filter: string; - - /** ListPolicyBasedRoutesRequest orderBy. */ - public orderBy: string; + constructor(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean); /** - * Creates a new ListPolicyBasedRoutesRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns ListPolicyBasedRoutesRequest instance + * Creates new HubService service using the specified rpc implementation. + * @param rpcImpl RPC implementation + * @param [requestDelimited=false] Whether requests are length-delimited + * @param [responseDelimited=false] Whether responses are length-delimited + * @returns RPC service. Useful where requests and/or responses are streamed. */ - public static create(properties?: google.cloud.networkconnectivity.v1.IListPolicyBasedRoutesRequest): google.cloud.networkconnectivity.v1.ListPolicyBasedRoutesRequest; + public static create(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean): HubService; /** - * Encodes the specified ListPolicyBasedRoutesRequest message. Does not implicitly {@link google.cloud.networkconnectivity.v1.ListPolicyBasedRoutesRequest.verify|verify} messages. - * @param message ListPolicyBasedRoutesRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer + * Calls ListHubs. + * @param request ListHubsRequest message or plain object + * @param callback Node-style callback called with the error, if any, and ListHubsResponse */ - public static encode(message: google.cloud.networkconnectivity.v1.IListPolicyBasedRoutesRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public listHubs(request: google.cloud.networkconnectivity.v1alpha1.IListHubsRequest, callback: google.cloud.networkconnectivity.v1alpha1.HubService.ListHubsCallback): void; /** - * Encodes the specified ListPolicyBasedRoutesRequest message, length delimited. Does not implicitly {@link google.cloud.networkconnectivity.v1.ListPolicyBasedRoutesRequest.verify|verify} messages. - * @param message ListPolicyBasedRoutesRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer + * Calls ListHubs. + * @param request ListHubsRequest message or plain object + * @returns Promise */ - public static encodeDelimited(message: google.cloud.networkconnectivity.v1.IListPolicyBasedRoutesRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public listHubs(request: google.cloud.networkconnectivity.v1alpha1.IListHubsRequest): Promise; /** - * Decodes a ListPolicyBasedRoutesRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns ListPolicyBasedRoutesRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing + * Calls GetHub. + * @param request GetHubRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Hub */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.networkconnectivity.v1.ListPolicyBasedRoutesRequest; + public getHub(request: google.cloud.networkconnectivity.v1alpha1.IGetHubRequest, callback: google.cloud.networkconnectivity.v1alpha1.HubService.GetHubCallback): void; /** - * Decodes a ListPolicyBasedRoutesRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns ListPolicyBasedRoutesRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing + * Calls GetHub. + * @param request GetHubRequest message or plain object + * @returns Promise */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.networkconnectivity.v1.ListPolicyBasedRoutesRequest; + public getHub(request: google.cloud.networkconnectivity.v1alpha1.IGetHubRequest): Promise; /** - * Verifies a ListPolicyBasedRoutesRequest message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not + * Calls CreateHub. + * @param request CreateHubRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation */ - public static verify(message: { [k: string]: any }): (string|null); + public createHub(request: google.cloud.networkconnectivity.v1alpha1.ICreateHubRequest, callback: google.cloud.networkconnectivity.v1alpha1.HubService.CreateHubCallback): void; /** - * Creates a ListPolicyBasedRoutesRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns ListPolicyBasedRoutesRequest + * Calls CreateHub. + * @param request CreateHubRequest message or plain object + * @returns Promise */ - public static fromObject(object: { [k: string]: any }): google.cloud.networkconnectivity.v1.ListPolicyBasedRoutesRequest; + public createHub(request: google.cloud.networkconnectivity.v1alpha1.ICreateHubRequest): Promise; /** - * Creates a plain object from a ListPolicyBasedRoutesRequest message. Also converts values to other types if specified. - * @param message ListPolicyBasedRoutesRequest - * @param [options] Conversion options - * @returns Plain object + * Calls UpdateHub. + * @param request UpdateHubRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation */ - public static toObject(message: google.cloud.networkconnectivity.v1.ListPolicyBasedRoutesRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this ListPolicyBasedRoutesRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for ListPolicyBasedRoutesRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a ListPolicyBasedRoutesResponse. */ - interface IListPolicyBasedRoutesResponse { - - /** ListPolicyBasedRoutesResponse policyBasedRoutes */ - policyBasedRoutes?: (google.cloud.networkconnectivity.v1.IPolicyBasedRoute[]|null); - - /** ListPolicyBasedRoutesResponse nextPageToken */ - nextPageToken?: (string|null); - - /** ListPolicyBasedRoutesResponse unreachable */ - unreachable?: (string[]|null); - } - - /** Represents a ListPolicyBasedRoutesResponse. */ - class ListPolicyBasedRoutesResponse implements IListPolicyBasedRoutesResponse { - - /** - * Constructs a new ListPolicyBasedRoutesResponse. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.networkconnectivity.v1.IListPolicyBasedRoutesResponse); - - /** ListPolicyBasedRoutesResponse policyBasedRoutes. */ - public policyBasedRoutes: google.cloud.networkconnectivity.v1.IPolicyBasedRoute[]; - - /** ListPolicyBasedRoutesResponse nextPageToken. */ - public nextPageToken: string; - - /** ListPolicyBasedRoutesResponse unreachable. */ - public unreachable: string[]; - - /** - * Creates a new ListPolicyBasedRoutesResponse instance using the specified properties. - * @param [properties] Properties to set - * @returns ListPolicyBasedRoutesResponse instance - */ - public static create(properties?: google.cloud.networkconnectivity.v1.IListPolicyBasedRoutesResponse): google.cloud.networkconnectivity.v1.ListPolicyBasedRoutesResponse; - - /** - * Encodes the specified ListPolicyBasedRoutesResponse message. Does not implicitly {@link google.cloud.networkconnectivity.v1.ListPolicyBasedRoutesResponse.verify|verify} messages. - * @param message ListPolicyBasedRoutesResponse message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.networkconnectivity.v1.IListPolicyBasedRoutesResponse, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified ListPolicyBasedRoutesResponse message, length delimited. Does not implicitly {@link google.cloud.networkconnectivity.v1.ListPolicyBasedRoutesResponse.verify|verify} messages. - * @param message ListPolicyBasedRoutesResponse message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.networkconnectivity.v1.IListPolicyBasedRoutesResponse, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a ListPolicyBasedRoutesResponse message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns ListPolicyBasedRoutesResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.networkconnectivity.v1.ListPolicyBasedRoutesResponse; - - /** - * Decodes a ListPolicyBasedRoutesResponse message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns ListPolicyBasedRoutesResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.networkconnectivity.v1.ListPolicyBasedRoutesResponse; - - /** - * Verifies a ListPolicyBasedRoutesResponse message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a ListPolicyBasedRoutesResponse message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns ListPolicyBasedRoutesResponse - */ - public static fromObject(object: { [k: string]: any }): google.cloud.networkconnectivity.v1.ListPolicyBasedRoutesResponse; - - /** - * Creates a plain object from a ListPolicyBasedRoutesResponse message. Also converts values to other types if specified. - * @param message ListPolicyBasedRoutesResponse - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.networkconnectivity.v1.ListPolicyBasedRoutesResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this ListPolicyBasedRoutesResponse to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for ListPolicyBasedRoutesResponse - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a GetPolicyBasedRouteRequest. */ - interface IGetPolicyBasedRouteRequest { - - /** GetPolicyBasedRouteRequest name */ - name?: (string|null); - } - - /** Represents a GetPolicyBasedRouteRequest. */ - class GetPolicyBasedRouteRequest implements IGetPolicyBasedRouteRequest { - - /** - * Constructs a new GetPolicyBasedRouteRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.networkconnectivity.v1.IGetPolicyBasedRouteRequest); - - /** GetPolicyBasedRouteRequest name. */ - public name: string; - - /** - * Creates a new GetPolicyBasedRouteRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns GetPolicyBasedRouteRequest instance - */ - public static create(properties?: google.cloud.networkconnectivity.v1.IGetPolicyBasedRouteRequest): google.cloud.networkconnectivity.v1.GetPolicyBasedRouteRequest; - - /** - * Encodes the specified GetPolicyBasedRouteRequest message. Does not implicitly {@link google.cloud.networkconnectivity.v1.GetPolicyBasedRouteRequest.verify|verify} messages. - * @param message GetPolicyBasedRouteRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.networkconnectivity.v1.IGetPolicyBasedRouteRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified GetPolicyBasedRouteRequest message, length delimited. Does not implicitly {@link google.cloud.networkconnectivity.v1.GetPolicyBasedRouteRequest.verify|verify} messages. - * @param message GetPolicyBasedRouteRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.networkconnectivity.v1.IGetPolicyBasedRouteRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a GetPolicyBasedRouteRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns GetPolicyBasedRouteRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.networkconnectivity.v1.GetPolicyBasedRouteRequest; - - /** - * Decodes a GetPolicyBasedRouteRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns GetPolicyBasedRouteRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.networkconnectivity.v1.GetPolicyBasedRouteRequest; - - /** - * Verifies a GetPolicyBasedRouteRequest message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a GetPolicyBasedRouteRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns GetPolicyBasedRouteRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.networkconnectivity.v1.GetPolicyBasedRouteRequest; - - /** - * Creates a plain object from a GetPolicyBasedRouteRequest message. Also converts values to other types if specified. - * @param message GetPolicyBasedRouteRequest - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.networkconnectivity.v1.GetPolicyBasedRouteRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this GetPolicyBasedRouteRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for GetPolicyBasedRouteRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a CreatePolicyBasedRouteRequest. */ - interface ICreatePolicyBasedRouteRequest { - - /** CreatePolicyBasedRouteRequest parent */ - parent?: (string|null); - - /** CreatePolicyBasedRouteRequest policyBasedRouteId */ - policyBasedRouteId?: (string|null); - - /** CreatePolicyBasedRouteRequest policyBasedRoute */ - policyBasedRoute?: (google.cloud.networkconnectivity.v1.IPolicyBasedRoute|null); - - /** CreatePolicyBasedRouteRequest requestId */ - requestId?: (string|null); - } - - /** Represents a CreatePolicyBasedRouteRequest. */ - class CreatePolicyBasedRouteRequest implements ICreatePolicyBasedRouteRequest { - - /** - * Constructs a new CreatePolicyBasedRouteRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.networkconnectivity.v1.ICreatePolicyBasedRouteRequest); - - /** CreatePolicyBasedRouteRequest parent. */ - public parent: string; - - /** CreatePolicyBasedRouteRequest policyBasedRouteId. */ - public policyBasedRouteId: string; - - /** CreatePolicyBasedRouteRequest policyBasedRoute. */ - public policyBasedRoute?: (google.cloud.networkconnectivity.v1.IPolicyBasedRoute|null); - - /** CreatePolicyBasedRouteRequest requestId. */ - public requestId: string; - - /** - * Creates a new CreatePolicyBasedRouteRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns CreatePolicyBasedRouteRequest instance - */ - public static create(properties?: google.cloud.networkconnectivity.v1.ICreatePolicyBasedRouteRequest): google.cloud.networkconnectivity.v1.CreatePolicyBasedRouteRequest; - - /** - * Encodes the specified CreatePolicyBasedRouteRequest message. Does not implicitly {@link google.cloud.networkconnectivity.v1.CreatePolicyBasedRouteRequest.verify|verify} messages. - * @param message CreatePolicyBasedRouteRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.networkconnectivity.v1.ICreatePolicyBasedRouteRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified CreatePolicyBasedRouteRequest message, length delimited. Does not implicitly {@link google.cloud.networkconnectivity.v1.CreatePolicyBasedRouteRequest.verify|verify} messages. - * @param message CreatePolicyBasedRouteRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.networkconnectivity.v1.ICreatePolicyBasedRouteRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a CreatePolicyBasedRouteRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns CreatePolicyBasedRouteRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.networkconnectivity.v1.CreatePolicyBasedRouteRequest; - - /** - * Decodes a CreatePolicyBasedRouteRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns CreatePolicyBasedRouteRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.networkconnectivity.v1.CreatePolicyBasedRouteRequest; - - /** - * Verifies a CreatePolicyBasedRouteRequest message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a CreatePolicyBasedRouteRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns CreatePolicyBasedRouteRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.networkconnectivity.v1.CreatePolicyBasedRouteRequest; - - /** - * Creates a plain object from a CreatePolicyBasedRouteRequest message. Also converts values to other types if specified. - * @param message CreatePolicyBasedRouteRequest - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.networkconnectivity.v1.CreatePolicyBasedRouteRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this CreatePolicyBasedRouteRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for CreatePolicyBasedRouteRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a DeletePolicyBasedRouteRequest. */ - interface IDeletePolicyBasedRouteRequest { - - /** DeletePolicyBasedRouteRequest name */ - name?: (string|null); - - /** DeletePolicyBasedRouteRequest requestId */ - requestId?: (string|null); - } - - /** Represents a DeletePolicyBasedRouteRequest. */ - class DeletePolicyBasedRouteRequest implements IDeletePolicyBasedRouteRequest { - - /** - * Constructs a new DeletePolicyBasedRouteRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.networkconnectivity.v1.IDeletePolicyBasedRouteRequest); - - /** DeletePolicyBasedRouteRequest name. */ - public name: string; - - /** DeletePolicyBasedRouteRequest requestId. */ - public requestId: string; - - /** - * Creates a new DeletePolicyBasedRouteRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns DeletePolicyBasedRouteRequest instance - */ - public static create(properties?: google.cloud.networkconnectivity.v1.IDeletePolicyBasedRouteRequest): google.cloud.networkconnectivity.v1.DeletePolicyBasedRouteRequest; - - /** - * Encodes the specified DeletePolicyBasedRouteRequest message. Does not implicitly {@link google.cloud.networkconnectivity.v1.DeletePolicyBasedRouteRequest.verify|verify} messages. - * @param message DeletePolicyBasedRouteRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.networkconnectivity.v1.IDeletePolicyBasedRouteRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified DeletePolicyBasedRouteRequest message, length delimited. Does not implicitly {@link google.cloud.networkconnectivity.v1.DeletePolicyBasedRouteRequest.verify|verify} messages. - * @param message DeletePolicyBasedRouteRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.networkconnectivity.v1.IDeletePolicyBasedRouteRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a DeletePolicyBasedRouteRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns DeletePolicyBasedRouteRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.networkconnectivity.v1.DeletePolicyBasedRouteRequest; - - /** - * Decodes a DeletePolicyBasedRouteRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns DeletePolicyBasedRouteRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.networkconnectivity.v1.DeletePolicyBasedRouteRequest; - - /** - * Verifies a DeletePolicyBasedRouteRequest message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a DeletePolicyBasedRouteRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns DeletePolicyBasedRouteRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.networkconnectivity.v1.DeletePolicyBasedRouteRequest; - - /** - * Creates a plain object from a DeletePolicyBasedRouteRequest message. Also converts values to other types if specified. - * @param message DeletePolicyBasedRouteRequest - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.networkconnectivity.v1.DeletePolicyBasedRouteRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this DeletePolicyBasedRouteRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for DeletePolicyBasedRouteRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - } - - /** Namespace v1alpha1. */ - namespace v1alpha1 { - - /** Properties of an OperationMetadata. */ - interface IOperationMetadata { - - /** OperationMetadata createTime */ - createTime?: (google.protobuf.ITimestamp|null); - - /** OperationMetadata endTime */ - endTime?: (google.protobuf.ITimestamp|null); - - /** OperationMetadata target */ - target?: (string|null); - - /** OperationMetadata verb */ - verb?: (string|null); - - /** OperationMetadata statusMessage */ - statusMessage?: (string|null); - - /** OperationMetadata requestedCancellation */ - requestedCancellation?: (boolean|null); - - /** OperationMetadata apiVersion */ - apiVersion?: (string|null); - } - - /** Represents an OperationMetadata. */ - class OperationMetadata implements IOperationMetadata { - - /** - * Constructs a new OperationMetadata. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.networkconnectivity.v1alpha1.IOperationMetadata); - - /** OperationMetadata createTime. */ - public createTime?: (google.protobuf.ITimestamp|null); - - /** OperationMetadata endTime. */ - public endTime?: (google.protobuf.ITimestamp|null); - - /** OperationMetadata target. */ - public target: string; - - /** OperationMetadata verb. */ - public verb: string; - - /** OperationMetadata statusMessage. */ - public statusMessage: string; - - /** OperationMetadata requestedCancellation. */ - public requestedCancellation: boolean; - - /** OperationMetadata apiVersion. */ - public apiVersion: string; - - /** - * Creates a new OperationMetadata instance using the specified properties. - * @param [properties] Properties to set - * @returns OperationMetadata instance - */ - public static create(properties?: google.cloud.networkconnectivity.v1alpha1.IOperationMetadata): google.cloud.networkconnectivity.v1alpha1.OperationMetadata; - - /** - * Encodes the specified OperationMetadata message. Does not implicitly {@link google.cloud.networkconnectivity.v1alpha1.OperationMetadata.verify|verify} messages. - * @param message OperationMetadata message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.networkconnectivity.v1alpha1.IOperationMetadata, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified OperationMetadata message, length delimited. Does not implicitly {@link google.cloud.networkconnectivity.v1alpha1.OperationMetadata.verify|verify} messages. - * @param message OperationMetadata message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.networkconnectivity.v1alpha1.IOperationMetadata, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes an OperationMetadata message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns OperationMetadata - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.networkconnectivity.v1alpha1.OperationMetadata; - - /** - * Decodes an OperationMetadata message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns OperationMetadata - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.networkconnectivity.v1alpha1.OperationMetadata; - - /** - * Verifies an OperationMetadata message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates an OperationMetadata message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns OperationMetadata - */ - public static fromObject(object: { [k: string]: any }): google.cloud.networkconnectivity.v1alpha1.OperationMetadata; - - /** - * Creates a plain object from an OperationMetadata message. Also converts values to other types if specified. - * @param message OperationMetadata - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.networkconnectivity.v1alpha1.OperationMetadata, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this OperationMetadata to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for OperationMetadata - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Represents a HubService */ - class HubService extends $protobuf.rpc.Service { - - /** - * Constructs a new HubService service. - * @param rpcImpl RPC implementation - * @param [requestDelimited=false] Whether requests are length-delimited - * @param [responseDelimited=false] Whether responses are length-delimited - */ - constructor(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean); - - /** - * Creates new HubService service using the specified rpc implementation. - * @param rpcImpl RPC implementation - * @param [requestDelimited=false] Whether requests are length-delimited - * @param [responseDelimited=false] Whether responses are length-delimited - * @returns RPC service. Useful where requests and/or responses are streamed. - */ - public static create(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean): HubService; - - /** - * Calls ListHubs. - * @param request ListHubsRequest message or plain object - * @param callback Node-style callback called with the error, if any, and ListHubsResponse - */ - public listHubs(request: google.cloud.networkconnectivity.v1alpha1.IListHubsRequest, callback: google.cloud.networkconnectivity.v1alpha1.HubService.ListHubsCallback): void; - - /** - * Calls ListHubs. - * @param request ListHubsRequest message or plain object - * @returns Promise - */ - public listHubs(request: google.cloud.networkconnectivity.v1alpha1.IListHubsRequest): Promise; - - /** - * Calls GetHub. - * @param request GetHubRequest message or plain object - * @param callback Node-style callback called with the error, if any, and Hub - */ - public getHub(request: google.cloud.networkconnectivity.v1alpha1.IGetHubRequest, callback: google.cloud.networkconnectivity.v1alpha1.HubService.GetHubCallback): void; - - /** - * Calls GetHub. - * @param request GetHubRequest message or plain object - * @returns Promise - */ - public getHub(request: google.cloud.networkconnectivity.v1alpha1.IGetHubRequest): Promise; - - /** - * Calls CreateHub. - * @param request CreateHubRequest message or plain object - * @param callback Node-style callback called with the error, if any, and Operation - */ - public createHub(request: google.cloud.networkconnectivity.v1alpha1.ICreateHubRequest, callback: google.cloud.networkconnectivity.v1alpha1.HubService.CreateHubCallback): void; - - /** - * Calls CreateHub. - * @param request CreateHubRequest message or plain object - * @returns Promise - */ - public createHub(request: google.cloud.networkconnectivity.v1alpha1.ICreateHubRequest): Promise; - - /** - * Calls UpdateHub. - * @param request UpdateHubRequest message or plain object - * @param callback Node-style callback called with the error, if any, and Operation - */ - public updateHub(request: google.cloud.networkconnectivity.v1alpha1.IUpdateHubRequest, callback: google.cloud.networkconnectivity.v1alpha1.HubService.UpdateHubCallback): void; + public updateHub(request: google.cloud.networkconnectivity.v1alpha1.IUpdateHubRequest, callback: google.cloud.networkconnectivity.v1alpha1.HubService.UpdateHubCallback): void; /** * Calls UpdateHub. @@ -6021,262 +4728,10 @@ export namespace google { OPTIONAL = 1, REQUIRED = 2, OUTPUT_ONLY = 3, - INPUT_ONLY = 4, - IMMUTABLE = 5, - UNORDERED_LIST = 6, - NON_EMPTY_DEFAULT = 7 - } - - /** Properties of a ResourceDescriptor. */ - interface IResourceDescriptor { - - /** ResourceDescriptor type */ - type?: (string|null); - - /** ResourceDescriptor pattern */ - pattern?: (string[]|null); - - /** ResourceDescriptor nameField */ - nameField?: (string|null); - - /** ResourceDescriptor history */ - history?: (google.api.ResourceDescriptor.History|keyof typeof google.api.ResourceDescriptor.History|null); - - /** ResourceDescriptor plural */ - plural?: (string|null); - - /** ResourceDescriptor singular */ - singular?: (string|null); - - /** ResourceDescriptor style */ - style?: (google.api.ResourceDescriptor.Style[]|null); - } - - /** Represents a ResourceDescriptor. */ - class ResourceDescriptor implements IResourceDescriptor { - - /** - * Constructs a new ResourceDescriptor. - * @param [properties] Properties to set - */ - constructor(properties?: google.api.IResourceDescriptor); - - /** ResourceDescriptor type. */ - public type: string; - - /** ResourceDescriptor pattern. */ - public pattern: string[]; - - /** ResourceDescriptor nameField. */ - public nameField: string; - - /** ResourceDescriptor history. */ - public history: (google.api.ResourceDescriptor.History|keyof typeof google.api.ResourceDescriptor.History); - - /** ResourceDescriptor plural. */ - public plural: string; - - /** ResourceDescriptor singular. */ - public singular: string; - - /** ResourceDescriptor style. */ - public style: google.api.ResourceDescriptor.Style[]; - - /** - * Creates a new ResourceDescriptor instance using the specified properties. - * @param [properties] Properties to set - * @returns ResourceDescriptor instance - */ - public static create(properties?: google.api.IResourceDescriptor): google.api.ResourceDescriptor; - - /** - * Encodes the specified ResourceDescriptor message. Does not implicitly {@link google.api.ResourceDescriptor.verify|verify} messages. - * @param message ResourceDescriptor message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.api.IResourceDescriptor, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified ResourceDescriptor message, length delimited. Does not implicitly {@link google.api.ResourceDescriptor.verify|verify} messages. - * @param message ResourceDescriptor message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.api.IResourceDescriptor, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a ResourceDescriptor message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns ResourceDescriptor - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.api.ResourceDescriptor; - - /** - * Decodes a ResourceDescriptor message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns ResourceDescriptor - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.api.ResourceDescriptor; - - /** - * Verifies a ResourceDescriptor message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a ResourceDescriptor message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns ResourceDescriptor - */ - public static fromObject(object: { [k: string]: any }): google.api.ResourceDescriptor; - - /** - * Creates a plain object from a ResourceDescriptor message. Also converts values to other types if specified. - * @param message ResourceDescriptor - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.api.ResourceDescriptor, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this ResourceDescriptor to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for ResourceDescriptor - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - namespace ResourceDescriptor { - - /** History enum. */ - enum History { - HISTORY_UNSPECIFIED = 0, - ORIGINALLY_SINGLE_PATTERN = 1, - FUTURE_MULTI_PATTERN = 2 - } - - /** Style enum. */ - enum Style { - STYLE_UNSPECIFIED = 0, - DECLARATIVE_FRIENDLY = 1 - } - } - - /** Properties of a ResourceReference. */ - interface IResourceReference { - - /** ResourceReference type */ - type?: (string|null); - - /** ResourceReference childType */ - childType?: (string|null); - } - - /** Represents a ResourceReference. */ - class ResourceReference implements IResourceReference { - - /** - * Constructs a new ResourceReference. - * @param [properties] Properties to set - */ - constructor(properties?: google.api.IResourceReference); - - /** ResourceReference type. */ - public type: string; - - /** ResourceReference childType. */ - public childType: string; - - /** - * Creates a new ResourceReference instance using the specified properties. - * @param [properties] Properties to set - * @returns ResourceReference instance - */ - public static create(properties?: google.api.IResourceReference): google.api.ResourceReference; - - /** - * Encodes the specified ResourceReference message. Does not implicitly {@link google.api.ResourceReference.verify|verify} messages. - * @param message ResourceReference message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.api.IResourceReference, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified ResourceReference message, length delimited. Does not implicitly {@link google.api.ResourceReference.verify|verify} messages. - * @param message ResourceReference message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.api.IResourceReference, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a ResourceReference message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns ResourceReference - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.api.ResourceReference; - - /** - * Decodes a ResourceReference message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns ResourceReference - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.api.ResourceReference; - - /** - * Verifies a ResourceReference message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a ResourceReference message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns ResourceReference - */ - public static fromObject(object: { [k: string]: any }): google.api.ResourceReference; - - /** - * Creates a plain object from a ResourceReference message. Also converts values to other types if specified. - * @param message ResourceReference - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.api.ResourceReference, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this ResourceReference to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for ResourceReference - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; + INPUT_ONLY = 4, + IMMUTABLE = 5, + UNORDERED_LIST = 6, + NON_EMPTY_DEFAULT = 7 } /** Properties of a Http. */ @@ -6638,6 +5093,258 @@ export namespace google { */ public static getTypeUrl(typeUrlPrefix?: string): string; } + + /** Properties of a ResourceDescriptor. */ + interface IResourceDescriptor { + + /** ResourceDescriptor type */ + type?: (string|null); + + /** ResourceDescriptor pattern */ + pattern?: (string[]|null); + + /** ResourceDescriptor nameField */ + nameField?: (string|null); + + /** ResourceDescriptor history */ + history?: (google.api.ResourceDescriptor.History|keyof typeof google.api.ResourceDescriptor.History|null); + + /** ResourceDescriptor plural */ + plural?: (string|null); + + /** ResourceDescriptor singular */ + singular?: (string|null); + + /** ResourceDescriptor style */ + style?: (google.api.ResourceDescriptor.Style[]|null); + } + + /** Represents a ResourceDescriptor. */ + class ResourceDescriptor implements IResourceDescriptor { + + /** + * Constructs a new ResourceDescriptor. + * @param [properties] Properties to set + */ + constructor(properties?: google.api.IResourceDescriptor); + + /** ResourceDescriptor type. */ + public type: string; + + /** ResourceDescriptor pattern. */ + public pattern: string[]; + + /** ResourceDescriptor nameField. */ + public nameField: string; + + /** ResourceDescriptor history. */ + public history: (google.api.ResourceDescriptor.History|keyof typeof google.api.ResourceDescriptor.History); + + /** ResourceDescriptor plural. */ + public plural: string; + + /** ResourceDescriptor singular. */ + public singular: string; + + /** ResourceDescriptor style. */ + public style: google.api.ResourceDescriptor.Style[]; + + /** + * Creates a new ResourceDescriptor instance using the specified properties. + * @param [properties] Properties to set + * @returns ResourceDescriptor instance + */ + public static create(properties?: google.api.IResourceDescriptor): google.api.ResourceDescriptor; + + /** + * Encodes the specified ResourceDescriptor message. Does not implicitly {@link google.api.ResourceDescriptor.verify|verify} messages. + * @param message ResourceDescriptor message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.api.IResourceDescriptor, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ResourceDescriptor message, length delimited. Does not implicitly {@link google.api.ResourceDescriptor.verify|verify} messages. + * @param message ResourceDescriptor message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.api.IResourceDescriptor, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ResourceDescriptor message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ResourceDescriptor + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.api.ResourceDescriptor; + + /** + * Decodes a ResourceDescriptor message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ResourceDescriptor + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.api.ResourceDescriptor; + + /** + * Verifies a ResourceDescriptor message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ResourceDescriptor message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ResourceDescriptor + */ + public static fromObject(object: { [k: string]: any }): google.api.ResourceDescriptor; + + /** + * Creates a plain object from a ResourceDescriptor message. Also converts values to other types if specified. + * @param message ResourceDescriptor + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.api.ResourceDescriptor, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ResourceDescriptor to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ResourceDescriptor + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace ResourceDescriptor { + + /** History enum. */ + enum History { + HISTORY_UNSPECIFIED = 0, + ORIGINALLY_SINGLE_PATTERN = 1, + FUTURE_MULTI_PATTERN = 2 + } + + /** Style enum. */ + enum Style { + STYLE_UNSPECIFIED = 0, + DECLARATIVE_FRIENDLY = 1 + } + } + + /** Properties of a ResourceReference. */ + interface IResourceReference { + + /** ResourceReference type */ + type?: (string|null); + + /** ResourceReference childType */ + childType?: (string|null); + } + + /** Represents a ResourceReference. */ + class ResourceReference implements IResourceReference { + + /** + * Constructs a new ResourceReference. + * @param [properties] Properties to set + */ + constructor(properties?: google.api.IResourceReference); + + /** ResourceReference type. */ + public type: string; + + /** ResourceReference childType. */ + public childType: string; + + /** + * Creates a new ResourceReference instance using the specified properties. + * @param [properties] Properties to set + * @returns ResourceReference instance + */ + public static create(properties?: google.api.IResourceReference): google.api.ResourceReference; + + /** + * Encodes the specified ResourceReference message. Does not implicitly {@link google.api.ResourceReference.verify|verify} messages. + * @param message ResourceReference message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.api.IResourceReference, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ResourceReference message, length delimited. Does not implicitly {@link google.api.ResourceReference.verify|verify} messages. + * @param message ResourceReference message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.api.IResourceReference, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ResourceReference message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ResourceReference + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.api.ResourceReference; + + /** + * Decodes a ResourceReference message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ResourceReference + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.api.ResourceReference; + + /** + * Verifies a ResourceReference message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ResourceReference message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ResourceReference + */ + public static fromObject(object: { [k: string]: any }): google.api.ResourceReference; + + /** + * Creates a plain object from a ResourceReference message. Also converts values to other types if specified. + * @param message ResourceReference + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.api.ResourceReference, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ResourceReference to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ResourceReference + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } } /** Namespace protobuf. */ diff --git a/packages/google-cloud-networkconnectivity/protos/protos.js b/packages/google-cloud-networkconnectivity/protos/protos.js index cf4b52d94c3..99335d9eb4c 100644 --- a/packages/google-cloud-networkconnectivity/protos/protos.js +++ b/packages/google-cloud-networkconnectivity/protos/protos.js @@ -783,22 +783,6 @@ return HubService; })(); - /** - * LocationFeature enum. - * @name google.cloud.networkconnectivity.v1.LocationFeature - * @enum {number} - * @property {number} LOCATION_FEATURE_UNSPECIFIED=0 LOCATION_FEATURE_UNSPECIFIED value - * @property {number} SITE_TO_CLOUD_SPOKES=1 SITE_TO_CLOUD_SPOKES value - * @property {number} SITE_TO_SITE_SPOKES=2 SITE_TO_SITE_SPOKES value - */ - v1.LocationFeature = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "LOCATION_FEATURE_UNSPECIFIED"] = 0; - values[valuesById[1] = "SITE_TO_CLOUD_SPOKES"] = 1; - values[valuesById[2] = "SITE_TO_SITE_SPOKES"] = 2; - return values; - })(); - /** * State enum. * @name google.cloud.networkconnectivity.v1.State @@ -807,7 +791,6 @@ * @property {number} CREATING=1 CREATING value * @property {number} ACTIVE=2 ACTIVE value * @property {number} DELETING=3 DELETING value - * @property {number} UPDATING=6 UPDATING value */ v1.State = (function() { var valuesById = {}, values = Object.create(valuesById); @@ -815,7 +798,22 @@ values[valuesById[1] = "CREATING"] = 1; values[valuesById[2] = "ACTIVE"] = 2; values[valuesById[3] = "DELETING"] = 3; - values[valuesById[6] = "UPDATING"] = 6; + return values; + })(); + + /** + * LocationFeature enum. + * @name google.cloud.networkconnectivity.v1.LocationFeature + * @enum {number} + * @property {number} LOCATION_FEATURE_UNSPECIFIED=0 LOCATION_FEATURE_UNSPECIFIED value + * @property {number} SITE_TO_CLOUD_SPOKES=1 SITE_TO_CLOUD_SPOKES value + * @property {number} SITE_TO_SITE_SPOKES=2 SITE_TO_SITE_SPOKES value + */ + v1.LocationFeature = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "LOCATION_FEATURE_UNSPECIFIED"] = 0; + values[valuesById[1] = "SITE_TO_CLOUD_SPOKES"] = 1; + values[valuesById[2] = "SITE_TO_SITE_SPOKES"] = 2; return values; })(); @@ -1115,7 +1113,6 @@ case 1: case 2: case 3: - case 6: break; } if (message.routingVpcs != null && message.hasOwnProperty("routingVpcs")) { @@ -1188,10 +1185,6 @@ case 3: message.state = 3; break; - case "UPDATING": - case 6: - message.state = 6; - break; } if (object.routingVpcs) { if (!Array.isArray(object.routingVpcs)) @@ -1868,7 +1861,6 @@ case 1: case 2: case 3: - case 6: break; } return null; @@ -1949,10 +1941,6 @@ case 3: message.state = 3; break; - case "UPDATING": - case 6: - message.state = 6; - break; } return message; }; @@ -5154,7 +5142,6 @@ * @interface ILinkedVpnTunnels * @property {Array.|null} [uris] LinkedVpnTunnels uris * @property {boolean|null} [siteToSiteDataTransfer] LinkedVpnTunnels siteToSiteDataTransfer - * @property {string|null} [vpcNetwork] LinkedVpnTunnels vpcNetwork */ /** @@ -5189,14 +5176,6 @@ */ LinkedVpnTunnels.prototype.siteToSiteDataTransfer = false; - /** - * LinkedVpnTunnels vpcNetwork. - * @member {string} vpcNetwork - * @memberof google.cloud.networkconnectivity.v1.LinkedVpnTunnels - * @instance - */ - LinkedVpnTunnels.prototype.vpcNetwork = ""; - /** * Creates a new LinkedVpnTunnels instance using the specified properties. * @function create @@ -5226,8 +5205,6 @@ writer.uint32(/* id 1, wireType 2 =*/10).string(message.uris[i]); if (message.siteToSiteDataTransfer != null && Object.hasOwnProperty.call(message, "siteToSiteDataTransfer")) writer.uint32(/* id 2, wireType 0 =*/16).bool(message.siteToSiteDataTransfer); - if (message.vpcNetwork != null && Object.hasOwnProperty.call(message, "vpcNetwork")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.vpcNetwork); return writer; }; @@ -5272,10 +5249,6 @@ message.siteToSiteDataTransfer = reader.bool(); break; } - case 3: { - message.vpcNetwork = reader.string(); - break; - } default: reader.skipType(tag & 7); break; @@ -5321,9 +5294,6 @@ if (message.siteToSiteDataTransfer != null && message.hasOwnProperty("siteToSiteDataTransfer")) if (typeof message.siteToSiteDataTransfer !== "boolean") return "siteToSiteDataTransfer: boolean expected"; - if (message.vpcNetwork != null && message.hasOwnProperty("vpcNetwork")) - if (!$util.isString(message.vpcNetwork)) - return "vpcNetwork: string expected"; return null; }; @@ -5348,8 +5318,6 @@ } if (object.siteToSiteDataTransfer != null) message.siteToSiteDataTransfer = Boolean(object.siteToSiteDataTransfer); - if (object.vpcNetwork != null) - message.vpcNetwork = String(object.vpcNetwork); return message; }; @@ -5368,10 +5336,8 @@ var object = {}; if (options.arrays || options.defaults) object.uris = []; - if (options.defaults) { + if (options.defaults) object.siteToSiteDataTransfer = false; - object.vpcNetwork = ""; - } if (message.uris && message.uris.length) { object.uris = []; for (var j = 0; j < message.uris.length; ++j) @@ -5379,8 +5345,6 @@ } if (message.siteToSiteDataTransfer != null && message.hasOwnProperty("siteToSiteDataTransfer")) object.siteToSiteDataTransfer = message.siteToSiteDataTransfer; - if (message.vpcNetwork != null && message.hasOwnProperty("vpcNetwork")) - object.vpcNetwork = message.vpcNetwork; return object; }; @@ -5421,7 +5385,6 @@ * @interface ILinkedInterconnectAttachments * @property {Array.|null} [uris] LinkedInterconnectAttachments uris * @property {boolean|null} [siteToSiteDataTransfer] LinkedInterconnectAttachments siteToSiteDataTransfer - * @property {string|null} [vpcNetwork] LinkedInterconnectAttachments vpcNetwork */ /** @@ -5456,14 +5419,6 @@ */ LinkedInterconnectAttachments.prototype.siteToSiteDataTransfer = false; - /** - * LinkedInterconnectAttachments vpcNetwork. - * @member {string} vpcNetwork - * @memberof google.cloud.networkconnectivity.v1.LinkedInterconnectAttachments - * @instance - */ - LinkedInterconnectAttachments.prototype.vpcNetwork = ""; - /** * Creates a new LinkedInterconnectAttachments instance using the specified properties. * @function create @@ -5493,8 +5448,6 @@ writer.uint32(/* id 1, wireType 2 =*/10).string(message.uris[i]); if (message.siteToSiteDataTransfer != null && Object.hasOwnProperty.call(message, "siteToSiteDataTransfer")) writer.uint32(/* id 2, wireType 0 =*/16).bool(message.siteToSiteDataTransfer); - if (message.vpcNetwork != null && Object.hasOwnProperty.call(message, "vpcNetwork")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.vpcNetwork); return writer; }; @@ -5539,10 +5492,6 @@ message.siteToSiteDataTransfer = reader.bool(); break; } - case 3: { - message.vpcNetwork = reader.string(); - break; - } default: reader.skipType(tag & 7); break; @@ -5588,9 +5537,6 @@ if (message.siteToSiteDataTransfer != null && message.hasOwnProperty("siteToSiteDataTransfer")) if (typeof message.siteToSiteDataTransfer !== "boolean") return "siteToSiteDataTransfer: boolean expected"; - if (message.vpcNetwork != null && message.hasOwnProperty("vpcNetwork")) - if (!$util.isString(message.vpcNetwork)) - return "vpcNetwork: string expected"; return null; }; @@ -5615,8 +5561,6 @@ } if (object.siteToSiteDataTransfer != null) message.siteToSiteDataTransfer = Boolean(object.siteToSiteDataTransfer); - if (object.vpcNetwork != null) - message.vpcNetwork = String(object.vpcNetwork); return message; }; @@ -5635,10 +5579,8 @@ var object = {}; if (options.arrays || options.defaults) object.uris = []; - if (options.defaults) { + if (options.defaults) object.siteToSiteDataTransfer = false; - object.vpcNetwork = ""; - } if (message.uris && message.uris.length) { object.uris = []; for (var j = 0; j < message.uris.length; ++j) @@ -5646,8 +5588,6 @@ } if (message.siteToSiteDataTransfer != null && message.hasOwnProperty("siteToSiteDataTransfer")) object.siteToSiteDataTransfer = message.siteToSiteDataTransfer; - if (message.vpcNetwork != null && message.hasOwnProperty("vpcNetwork")) - object.vpcNetwork = message.vpcNetwork; return object; }; @@ -5688,7 +5628,6 @@ * @interface ILinkedRouterApplianceInstances * @property {Array.|null} [instances] LinkedRouterApplianceInstances instances * @property {boolean|null} [siteToSiteDataTransfer] LinkedRouterApplianceInstances siteToSiteDataTransfer - * @property {string|null} [vpcNetwork] LinkedRouterApplianceInstances vpcNetwork */ /** @@ -5723,14 +5662,6 @@ */ LinkedRouterApplianceInstances.prototype.siteToSiteDataTransfer = false; - /** - * LinkedRouterApplianceInstances vpcNetwork. - * @member {string} vpcNetwork - * @memberof google.cloud.networkconnectivity.v1.LinkedRouterApplianceInstances - * @instance - */ - LinkedRouterApplianceInstances.prototype.vpcNetwork = ""; - /** * Creates a new LinkedRouterApplianceInstances instance using the specified properties. * @function create @@ -5760,8 +5691,6 @@ $root.google.cloud.networkconnectivity.v1.RouterApplianceInstance.encode(message.instances[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); if (message.siteToSiteDataTransfer != null && Object.hasOwnProperty.call(message, "siteToSiteDataTransfer")) writer.uint32(/* id 2, wireType 0 =*/16).bool(message.siteToSiteDataTransfer); - if (message.vpcNetwork != null && Object.hasOwnProperty.call(message, "vpcNetwork")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.vpcNetwork); return writer; }; @@ -5806,10 +5735,6 @@ message.siteToSiteDataTransfer = reader.bool(); break; } - case 3: { - message.vpcNetwork = reader.string(); - break; - } default: reader.skipType(tag & 7); break; @@ -5857,9 +5782,6 @@ if (message.siteToSiteDataTransfer != null && message.hasOwnProperty("siteToSiteDataTransfer")) if (typeof message.siteToSiteDataTransfer !== "boolean") return "siteToSiteDataTransfer: boolean expected"; - if (message.vpcNetwork != null && message.hasOwnProperty("vpcNetwork")) - if (!$util.isString(message.vpcNetwork)) - return "vpcNetwork: string expected"; return null; }; @@ -5887,8 +5809,6 @@ } if (object.siteToSiteDataTransfer != null) message.siteToSiteDataTransfer = Boolean(object.siteToSiteDataTransfer); - if (object.vpcNetwork != null) - message.vpcNetwork = String(object.vpcNetwork); return message; }; @@ -5907,10 +5827,8 @@ var object = {}; if (options.arrays || options.defaults) object.instances = []; - if (options.defaults) { + if (options.defaults) object.siteToSiteDataTransfer = false; - object.vpcNetwork = ""; - } if (message.instances && message.instances.length) { object.instances = []; for (var j = 0; j < message.instances.length; ++j) @@ -5918,8 +5836,6 @@ } if (message.siteToSiteDataTransfer != null && message.hasOwnProperty("siteToSiteDataTransfer")) object.siteToSiteDataTransfer = message.siteToSiteDataTransfer; - if (message.vpcNetwork != null && message.hasOwnProperty("vpcNetwork")) - object.vpcNetwork = message.vpcNetwork; return object; }; @@ -6430,206 +6346,42 @@ return LocationMetadata; })(); - v1.PolicyBasedRoutingService = (function() { - - /** - * Constructs a new PolicyBasedRoutingService service. - * @memberof google.cloud.networkconnectivity.v1 - * @classdesc Represents a PolicyBasedRoutingService - * @extends $protobuf.rpc.Service - * @constructor - * @param {$protobuf.RPCImpl} rpcImpl RPC implementation - * @param {boolean} [requestDelimited=false] Whether requests are length-delimited - * @param {boolean} [responseDelimited=false] Whether responses are length-delimited - */ - function PolicyBasedRoutingService(rpcImpl, requestDelimited, responseDelimited) { - $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); - } - - (PolicyBasedRoutingService.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = PolicyBasedRoutingService; - - /** - * Creates new PolicyBasedRoutingService service using the specified rpc implementation. - * @function create - * @memberof google.cloud.networkconnectivity.v1.PolicyBasedRoutingService - * @static - * @param {$protobuf.RPCImpl} rpcImpl RPC implementation - * @param {boolean} [requestDelimited=false] Whether requests are length-delimited - * @param {boolean} [responseDelimited=false] Whether responses are length-delimited - * @returns {PolicyBasedRoutingService} RPC service. Useful where requests and/or responses are streamed. - */ - PolicyBasedRoutingService.create = function create(rpcImpl, requestDelimited, responseDelimited) { - return new this(rpcImpl, requestDelimited, responseDelimited); - }; - - /** - * Callback as used by {@link google.cloud.networkconnectivity.v1.PolicyBasedRoutingService|listPolicyBasedRoutes}. - * @memberof google.cloud.networkconnectivity.v1.PolicyBasedRoutingService - * @typedef ListPolicyBasedRoutesCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.networkconnectivity.v1.ListPolicyBasedRoutesResponse} [response] ListPolicyBasedRoutesResponse - */ - - /** - * Calls ListPolicyBasedRoutes. - * @function listPolicyBasedRoutes - * @memberof google.cloud.networkconnectivity.v1.PolicyBasedRoutingService - * @instance - * @param {google.cloud.networkconnectivity.v1.IListPolicyBasedRoutesRequest} request ListPolicyBasedRoutesRequest message or plain object - * @param {google.cloud.networkconnectivity.v1.PolicyBasedRoutingService.ListPolicyBasedRoutesCallback} callback Node-style callback called with the error, if any, and ListPolicyBasedRoutesResponse - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(PolicyBasedRoutingService.prototype.listPolicyBasedRoutes = function listPolicyBasedRoutes(request, callback) { - return this.rpcCall(listPolicyBasedRoutes, $root.google.cloud.networkconnectivity.v1.ListPolicyBasedRoutesRequest, $root.google.cloud.networkconnectivity.v1.ListPolicyBasedRoutesResponse, request, callback); - }, "name", { value: "ListPolicyBasedRoutes" }); - - /** - * Calls ListPolicyBasedRoutes. - * @function listPolicyBasedRoutes - * @memberof google.cloud.networkconnectivity.v1.PolicyBasedRoutingService - * @instance - * @param {google.cloud.networkconnectivity.v1.IListPolicyBasedRoutesRequest} request ListPolicyBasedRoutesRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link google.cloud.networkconnectivity.v1.PolicyBasedRoutingService|getPolicyBasedRoute}. - * @memberof google.cloud.networkconnectivity.v1.PolicyBasedRoutingService - * @typedef GetPolicyBasedRouteCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.networkconnectivity.v1.PolicyBasedRoute} [response] PolicyBasedRoute - */ - - /** - * Calls GetPolicyBasedRoute. - * @function getPolicyBasedRoute - * @memberof google.cloud.networkconnectivity.v1.PolicyBasedRoutingService - * @instance - * @param {google.cloud.networkconnectivity.v1.IGetPolicyBasedRouteRequest} request GetPolicyBasedRouteRequest message or plain object - * @param {google.cloud.networkconnectivity.v1.PolicyBasedRoutingService.GetPolicyBasedRouteCallback} callback Node-style callback called with the error, if any, and PolicyBasedRoute - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(PolicyBasedRoutingService.prototype.getPolicyBasedRoute = function getPolicyBasedRoute(request, callback) { - return this.rpcCall(getPolicyBasedRoute, $root.google.cloud.networkconnectivity.v1.GetPolicyBasedRouteRequest, $root.google.cloud.networkconnectivity.v1.PolicyBasedRoute, request, callback); - }, "name", { value: "GetPolicyBasedRoute" }); - - /** - * Calls GetPolicyBasedRoute. - * @function getPolicyBasedRoute - * @memberof google.cloud.networkconnectivity.v1.PolicyBasedRoutingService - * @instance - * @param {google.cloud.networkconnectivity.v1.IGetPolicyBasedRouteRequest} request GetPolicyBasedRouteRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link google.cloud.networkconnectivity.v1.PolicyBasedRoutingService|createPolicyBasedRoute}. - * @memberof google.cloud.networkconnectivity.v1.PolicyBasedRoutingService - * @typedef CreatePolicyBasedRouteCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.longrunning.Operation} [response] Operation - */ - - /** - * Calls CreatePolicyBasedRoute. - * @function createPolicyBasedRoute - * @memberof google.cloud.networkconnectivity.v1.PolicyBasedRoutingService - * @instance - * @param {google.cloud.networkconnectivity.v1.ICreatePolicyBasedRouteRequest} request CreatePolicyBasedRouteRequest message or plain object - * @param {google.cloud.networkconnectivity.v1.PolicyBasedRoutingService.CreatePolicyBasedRouteCallback} callback Node-style callback called with the error, if any, and Operation - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(PolicyBasedRoutingService.prototype.createPolicyBasedRoute = function createPolicyBasedRoute(request, callback) { - return this.rpcCall(createPolicyBasedRoute, $root.google.cloud.networkconnectivity.v1.CreatePolicyBasedRouteRequest, $root.google.longrunning.Operation, request, callback); - }, "name", { value: "CreatePolicyBasedRoute" }); + return v1; + })(); - /** - * Calls CreatePolicyBasedRoute. - * @function createPolicyBasedRoute - * @memberof google.cloud.networkconnectivity.v1.PolicyBasedRoutingService - * @instance - * @param {google.cloud.networkconnectivity.v1.ICreatePolicyBasedRouteRequest} request CreatePolicyBasedRouteRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ + networkconnectivity.v1alpha1 = (function() { - /** - * Callback as used by {@link google.cloud.networkconnectivity.v1.PolicyBasedRoutingService|deletePolicyBasedRoute}. - * @memberof google.cloud.networkconnectivity.v1.PolicyBasedRoutingService - * @typedef DeletePolicyBasedRouteCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.longrunning.Operation} [response] Operation - */ + /** + * Namespace v1alpha1. + * @memberof google.cloud.networkconnectivity + * @namespace + */ + var v1alpha1 = {}; - /** - * Calls DeletePolicyBasedRoute. - * @function deletePolicyBasedRoute - * @memberof google.cloud.networkconnectivity.v1.PolicyBasedRoutingService - * @instance - * @param {google.cloud.networkconnectivity.v1.IDeletePolicyBasedRouteRequest} request DeletePolicyBasedRouteRequest message or plain object - * @param {google.cloud.networkconnectivity.v1.PolicyBasedRoutingService.DeletePolicyBasedRouteCallback} callback Node-style callback called with the error, if any, and Operation - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(PolicyBasedRoutingService.prototype.deletePolicyBasedRoute = function deletePolicyBasedRoute(request, callback) { - return this.rpcCall(deletePolicyBasedRoute, $root.google.cloud.networkconnectivity.v1.DeletePolicyBasedRouteRequest, $root.google.longrunning.Operation, request, callback); - }, "name", { value: "DeletePolicyBasedRoute" }); + v1alpha1.OperationMetadata = (function() { /** - * Calls DeletePolicyBasedRoute. - * @function deletePolicyBasedRoute - * @memberof google.cloud.networkconnectivity.v1.PolicyBasedRoutingService - * @instance - * @param {google.cloud.networkconnectivity.v1.IDeletePolicyBasedRouteRequest} request DeletePolicyBasedRouteRequest message or plain object - * @returns {Promise} Promise - * @variation 2 + * Properties of an OperationMetadata. + * @memberof google.cloud.networkconnectivity.v1alpha1 + * @interface IOperationMetadata + * @property {google.protobuf.ITimestamp|null} [createTime] OperationMetadata createTime + * @property {google.protobuf.ITimestamp|null} [endTime] OperationMetadata endTime + * @property {string|null} [target] OperationMetadata target + * @property {string|null} [verb] OperationMetadata verb + * @property {string|null} [statusMessage] OperationMetadata statusMessage + * @property {boolean|null} [requestedCancellation] OperationMetadata requestedCancellation + * @property {string|null} [apiVersion] OperationMetadata apiVersion */ - return PolicyBasedRoutingService; - })(); - - v1.PolicyBasedRoute = (function() { - /** - * Properties of a PolicyBasedRoute. - * @memberof google.cloud.networkconnectivity.v1 - * @interface IPolicyBasedRoute - * @property {google.cloud.networkconnectivity.v1.PolicyBasedRoute.IVirtualMachine|null} [virtualMachine] PolicyBasedRoute virtualMachine - * @property {google.cloud.networkconnectivity.v1.PolicyBasedRoute.IInterconnectAttachment|null} [interconnectAttachment] PolicyBasedRoute interconnectAttachment - * @property {string|null} [nextHopIlbIp] PolicyBasedRoute nextHopIlbIp - * @property {string|null} [name] PolicyBasedRoute name - * @property {google.protobuf.ITimestamp|null} [createTime] PolicyBasedRoute createTime - * @property {google.protobuf.ITimestamp|null} [updateTime] PolicyBasedRoute updateTime - * @property {Object.|null} [labels] PolicyBasedRoute labels - * @property {string|null} [description] PolicyBasedRoute description - * @property {string|null} [network] PolicyBasedRoute network - * @property {google.cloud.networkconnectivity.v1.PolicyBasedRoute.IFilter|null} [filter] PolicyBasedRoute filter - * @property {number|null} [priority] PolicyBasedRoute priority - * @property {Array.|null} [warnings] PolicyBasedRoute warnings - * @property {string|null} [selfLink] PolicyBasedRoute selfLink - * @property {string|null} [kind] PolicyBasedRoute kind - */ - - /** - * Constructs a new PolicyBasedRoute. - * @memberof google.cloud.networkconnectivity.v1 - * @classdesc Represents a PolicyBasedRoute. - * @implements IPolicyBasedRoute + * Constructs a new OperationMetadata. + * @memberof google.cloud.networkconnectivity.v1alpha1 + * @classdesc Represents an OperationMetadata. + * @implements IOperationMetadata * @constructor - * @param {google.cloud.networkconnectivity.v1.IPolicyBasedRoute=} [properties] Properties to set + * @param {google.cloud.networkconnectivity.v1alpha1.IOperationMetadata=} [properties] Properties to set */ - function PolicyBasedRoute(properties) { - this.labels = {}; - this.warnings = []; + function OperationMetadata(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -6637,305 +6389,159 @@ } /** - * PolicyBasedRoute virtualMachine. - * @member {google.cloud.networkconnectivity.v1.PolicyBasedRoute.IVirtualMachine|null|undefined} virtualMachine - * @memberof google.cloud.networkconnectivity.v1.PolicyBasedRoute + * OperationMetadata createTime. + * @member {google.protobuf.ITimestamp|null|undefined} createTime + * @memberof google.cloud.networkconnectivity.v1alpha1.OperationMetadata * @instance */ - PolicyBasedRoute.prototype.virtualMachine = null; + OperationMetadata.prototype.createTime = null; /** - * PolicyBasedRoute interconnectAttachment. - * @member {google.cloud.networkconnectivity.v1.PolicyBasedRoute.IInterconnectAttachment|null|undefined} interconnectAttachment - * @memberof google.cloud.networkconnectivity.v1.PolicyBasedRoute + * OperationMetadata endTime. + * @member {google.protobuf.ITimestamp|null|undefined} endTime + * @memberof google.cloud.networkconnectivity.v1alpha1.OperationMetadata * @instance */ - PolicyBasedRoute.prototype.interconnectAttachment = null; + OperationMetadata.prototype.endTime = null; /** - * PolicyBasedRoute nextHopIlbIp. - * @member {string|null|undefined} nextHopIlbIp - * @memberof google.cloud.networkconnectivity.v1.PolicyBasedRoute + * OperationMetadata target. + * @member {string} target + * @memberof google.cloud.networkconnectivity.v1alpha1.OperationMetadata * @instance */ - PolicyBasedRoute.prototype.nextHopIlbIp = null; + OperationMetadata.prototype.target = ""; /** - * PolicyBasedRoute name. - * @member {string} name - * @memberof google.cloud.networkconnectivity.v1.PolicyBasedRoute + * OperationMetadata verb. + * @member {string} verb + * @memberof google.cloud.networkconnectivity.v1alpha1.OperationMetadata * @instance */ - PolicyBasedRoute.prototype.name = ""; + OperationMetadata.prototype.verb = ""; /** - * PolicyBasedRoute createTime. - * @member {google.protobuf.ITimestamp|null|undefined} createTime - * @memberof google.cloud.networkconnectivity.v1.PolicyBasedRoute + * OperationMetadata statusMessage. + * @member {string} statusMessage + * @memberof google.cloud.networkconnectivity.v1alpha1.OperationMetadata * @instance */ - PolicyBasedRoute.prototype.createTime = null; + OperationMetadata.prototype.statusMessage = ""; /** - * PolicyBasedRoute updateTime. - * @member {google.protobuf.ITimestamp|null|undefined} updateTime - * @memberof google.cloud.networkconnectivity.v1.PolicyBasedRoute + * OperationMetadata requestedCancellation. + * @member {boolean} requestedCancellation + * @memberof google.cloud.networkconnectivity.v1alpha1.OperationMetadata * @instance */ - PolicyBasedRoute.prototype.updateTime = null; + OperationMetadata.prototype.requestedCancellation = false; /** - * PolicyBasedRoute labels. - * @member {Object.} labels - * @memberof google.cloud.networkconnectivity.v1.PolicyBasedRoute + * OperationMetadata apiVersion. + * @member {string} apiVersion + * @memberof google.cloud.networkconnectivity.v1alpha1.OperationMetadata * @instance */ - PolicyBasedRoute.prototype.labels = $util.emptyObject; + OperationMetadata.prototype.apiVersion = ""; /** - * PolicyBasedRoute description. - * @member {string} description - * @memberof google.cloud.networkconnectivity.v1.PolicyBasedRoute - * @instance + * Creates a new OperationMetadata instance using the specified properties. + * @function create + * @memberof google.cloud.networkconnectivity.v1alpha1.OperationMetadata + * @static + * @param {google.cloud.networkconnectivity.v1alpha1.IOperationMetadata=} [properties] Properties to set + * @returns {google.cloud.networkconnectivity.v1alpha1.OperationMetadata} OperationMetadata instance */ - PolicyBasedRoute.prototype.description = ""; + OperationMetadata.create = function create(properties) { + return new OperationMetadata(properties); + }; /** - * PolicyBasedRoute network. - * @member {string} network - * @memberof google.cloud.networkconnectivity.v1.PolicyBasedRoute - * @instance + * Encodes the specified OperationMetadata message. Does not implicitly {@link google.cloud.networkconnectivity.v1alpha1.OperationMetadata.verify|verify} messages. + * @function encode + * @memberof google.cloud.networkconnectivity.v1alpha1.OperationMetadata + * @static + * @param {google.cloud.networkconnectivity.v1alpha1.IOperationMetadata} message OperationMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer */ - PolicyBasedRoute.prototype.network = ""; + OperationMetadata.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.createTime != null && Object.hasOwnProperty.call(message, "createTime")) + $root.google.protobuf.Timestamp.encode(message.createTime, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.endTime != null && Object.hasOwnProperty.call(message, "endTime")) + $root.google.protobuf.Timestamp.encode(message.endTime, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.target != null && Object.hasOwnProperty.call(message, "target")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.target); + if (message.verb != null && Object.hasOwnProperty.call(message, "verb")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.verb); + if (message.statusMessage != null && Object.hasOwnProperty.call(message, "statusMessage")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.statusMessage); + if (message.requestedCancellation != null && Object.hasOwnProperty.call(message, "requestedCancellation")) + writer.uint32(/* id 6, wireType 0 =*/48).bool(message.requestedCancellation); + if (message.apiVersion != null && Object.hasOwnProperty.call(message, "apiVersion")) + writer.uint32(/* id 7, wireType 2 =*/58).string(message.apiVersion); + return writer; + }; /** - * PolicyBasedRoute filter. - * @member {google.cloud.networkconnectivity.v1.PolicyBasedRoute.IFilter|null|undefined} filter - * @memberof google.cloud.networkconnectivity.v1.PolicyBasedRoute - * @instance - */ - PolicyBasedRoute.prototype.filter = null; - - /** - * PolicyBasedRoute priority. - * @member {number} priority - * @memberof google.cloud.networkconnectivity.v1.PolicyBasedRoute - * @instance - */ - PolicyBasedRoute.prototype.priority = 0; - - /** - * PolicyBasedRoute warnings. - * @member {Array.} warnings - * @memberof google.cloud.networkconnectivity.v1.PolicyBasedRoute - * @instance - */ - PolicyBasedRoute.prototype.warnings = $util.emptyArray; - - /** - * PolicyBasedRoute selfLink. - * @member {string} selfLink - * @memberof google.cloud.networkconnectivity.v1.PolicyBasedRoute - * @instance - */ - PolicyBasedRoute.prototype.selfLink = ""; - - /** - * PolicyBasedRoute kind. - * @member {string} kind - * @memberof google.cloud.networkconnectivity.v1.PolicyBasedRoute - * @instance - */ - PolicyBasedRoute.prototype.kind = ""; - - // OneOf field names bound to virtual getters and setters - var $oneOfFields; - - /** - * PolicyBasedRoute target. - * @member {"virtualMachine"|"interconnectAttachment"|undefined} target - * @memberof google.cloud.networkconnectivity.v1.PolicyBasedRoute - * @instance - */ - Object.defineProperty(PolicyBasedRoute.prototype, "target", { - get: $util.oneOfGetter($oneOfFields = ["virtualMachine", "interconnectAttachment"]), - set: $util.oneOfSetter($oneOfFields) - }); - - /** - * PolicyBasedRoute nextHop. - * @member {"nextHopIlbIp"|undefined} nextHop - * @memberof google.cloud.networkconnectivity.v1.PolicyBasedRoute - * @instance - */ - Object.defineProperty(PolicyBasedRoute.prototype, "nextHop", { - get: $util.oneOfGetter($oneOfFields = ["nextHopIlbIp"]), - set: $util.oneOfSetter($oneOfFields) - }); - - /** - * Creates a new PolicyBasedRoute instance using the specified properties. - * @function create - * @memberof google.cloud.networkconnectivity.v1.PolicyBasedRoute - * @static - * @param {google.cloud.networkconnectivity.v1.IPolicyBasedRoute=} [properties] Properties to set - * @returns {google.cloud.networkconnectivity.v1.PolicyBasedRoute} PolicyBasedRoute instance - */ - PolicyBasedRoute.create = function create(properties) { - return new PolicyBasedRoute(properties); - }; - - /** - * Encodes the specified PolicyBasedRoute message. Does not implicitly {@link google.cloud.networkconnectivity.v1.PolicyBasedRoute.verify|verify} messages. - * @function encode - * @memberof google.cloud.networkconnectivity.v1.PolicyBasedRoute - * @static - * @param {google.cloud.networkconnectivity.v1.IPolicyBasedRoute} message PolicyBasedRoute message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - PolicyBasedRoute.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.name != null && Object.hasOwnProperty.call(message, "name")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); - if (message.createTime != null && Object.hasOwnProperty.call(message, "createTime")) - $root.google.protobuf.Timestamp.encode(message.createTime, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.updateTime != null && Object.hasOwnProperty.call(message, "updateTime")) - $root.google.protobuf.Timestamp.encode(message.updateTime, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - if (message.labels != null && Object.hasOwnProperty.call(message, "labels")) - for (var keys = Object.keys(message.labels), i = 0; i < keys.length; ++i) - writer.uint32(/* id 4, wireType 2 =*/34).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]).uint32(/* id 2, wireType 2 =*/18).string(message.labels[keys[i]]).ldelim(); - if (message.description != null && Object.hasOwnProperty.call(message, "description")) - writer.uint32(/* id 5, wireType 2 =*/42).string(message.description); - if (message.network != null && Object.hasOwnProperty.call(message, "network")) - writer.uint32(/* id 6, wireType 2 =*/50).string(message.network); - if (message.interconnectAttachment != null && Object.hasOwnProperty.call(message, "interconnectAttachment")) - $root.google.cloud.networkconnectivity.v1.PolicyBasedRoute.InterconnectAttachment.encode(message.interconnectAttachment, writer.uint32(/* id 9, wireType 2 =*/74).fork()).ldelim(); - if (message.filter != null && Object.hasOwnProperty.call(message, "filter")) - $root.google.cloud.networkconnectivity.v1.PolicyBasedRoute.Filter.encode(message.filter, writer.uint32(/* id 10, wireType 2 =*/82).fork()).ldelim(); - if (message.priority != null && Object.hasOwnProperty.call(message, "priority")) - writer.uint32(/* id 11, wireType 0 =*/88).int32(message.priority); - if (message.nextHopIlbIp != null && Object.hasOwnProperty.call(message, "nextHopIlbIp")) - writer.uint32(/* id 12, wireType 2 =*/98).string(message.nextHopIlbIp); - if (message.warnings != null && message.warnings.length) - for (var i = 0; i < message.warnings.length; ++i) - $root.google.cloud.networkconnectivity.v1.PolicyBasedRoute.Warnings.encode(message.warnings[i], writer.uint32(/* id 14, wireType 2 =*/114).fork()).ldelim(); - if (message.selfLink != null && Object.hasOwnProperty.call(message, "selfLink")) - writer.uint32(/* id 15, wireType 2 =*/122).string(message.selfLink); - if (message.kind != null && Object.hasOwnProperty.call(message, "kind")) - writer.uint32(/* id 16, wireType 2 =*/130).string(message.kind); - if (message.virtualMachine != null && Object.hasOwnProperty.call(message, "virtualMachine")) - $root.google.cloud.networkconnectivity.v1.PolicyBasedRoute.VirtualMachine.encode(message.virtualMachine, writer.uint32(/* id 18, wireType 2 =*/146).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified PolicyBasedRoute message, length delimited. Does not implicitly {@link google.cloud.networkconnectivity.v1.PolicyBasedRoute.verify|verify} messages. + * Encodes the specified OperationMetadata message, length delimited. Does not implicitly {@link google.cloud.networkconnectivity.v1alpha1.OperationMetadata.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.networkconnectivity.v1.PolicyBasedRoute + * @memberof google.cloud.networkconnectivity.v1alpha1.OperationMetadata * @static - * @param {google.cloud.networkconnectivity.v1.IPolicyBasedRoute} message PolicyBasedRoute message or plain object to encode + * @param {google.cloud.networkconnectivity.v1alpha1.IOperationMetadata} message OperationMetadata message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - PolicyBasedRoute.encodeDelimited = function encodeDelimited(message, writer) { + OperationMetadata.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a PolicyBasedRoute message from the specified reader or buffer. + * Decodes an OperationMetadata message from the specified reader or buffer. * @function decode - * @memberof google.cloud.networkconnectivity.v1.PolicyBasedRoute + * @memberof google.cloud.networkconnectivity.v1alpha1.OperationMetadata * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.networkconnectivity.v1.PolicyBasedRoute} PolicyBasedRoute + * @returns {google.cloud.networkconnectivity.v1alpha1.OperationMetadata} OperationMetadata * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - PolicyBasedRoute.decode = function decode(reader, length) { + OperationMetadata.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.networkconnectivity.v1.PolicyBasedRoute(), key, value; + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.networkconnectivity.v1alpha1.OperationMetadata(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 18: { - message.virtualMachine = $root.google.cloud.networkconnectivity.v1.PolicyBasedRoute.VirtualMachine.decode(reader, reader.uint32()); - break; - } - case 9: { - message.interconnectAttachment = $root.google.cloud.networkconnectivity.v1.PolicyBasedRoute.InterconnectAttachment.decode(reader, reader.uint32()); - break; - } - case 12: { - message.nextHopIlbIp = reader.string(); - break; - } case 1: { - message.name = reader.string(); + message.createTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); break; } case 2: { - message.createTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + message.endTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); break; } case 3: { - message.updateTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + message.target = reader.string(); break; } case 4: { - if (message.labels === $util.emptyObject) - message.labels = {}; - var end2 = reader.uint32() + reader.pos; - key = ""; - value = ""; - while (reader.pos < end2) { - var tag2 = reader.uint32(); - switch (tag2 >>> 3) { - case 1: - key = reader.string(); - break; - case 2: - value = reader.string(); - break; - default: - reader.skipType(tag2 & 7); - break; - } - } - message.labels[key] = value; + message.verb = reader.string(); break; } case 5: { - message.description = reader.string(); + message.statusMessage = reader.string(); break; } case 6: { - message.network = reader.string(); - break; - } - case 10: { - message.filter = $root.google.cloud.networkconnectivity.v1.PolicyBasedRoute.Filter.decode(reader, reader.uint32()); - break; - } - case 11: { - message.priority = reader.int32(); - break; - } - case 14: { - if (!(message.warnings && message.warnings.length)) - message.warnings = []; - message.warnings.push($root.google.cloud.networkconnectivity.v1.PolicyBasedRoute.Warnings.decode(reader, reader.uint32())); - break; - } - case 15: { - message.selfLink = reader.string(); + message.requestedCancellation = reader.bool(); break; } - case 16: { - message.kind = reader.string(); + case 7: { + message.apiVersion = reader.string(); break; } default: @@ -6947,2978 +6553,147 @@ }; /** - * Decodes a PolicyBasedRoute message from the specified reader or buffer, length delimited. + * Decodes an OperationMetadata message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.networkconnectivity.v1.PolicyBasedRoute + * @memberof google.cloud.networkconnectivity.v1alpha1.OperationMetadata * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.networkconnectivity.v1.PolicyBasedRoute} PolicyBasedRoute + * @returns {google.cloud.networkconnectivity.v1alpha1.OperationMetadata} OperationMetadata * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - PolicyBasedRoute.decodeDelimited = function decodeDelimited(reader) { + OperationMetadata.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a PolicyBasedRoute message. + * Verifies an OperationMetadata message. * @function verify - * @memberof google.cloud.networkconnectivity.v1.PolicyBasedRoute + * @memberof google.cloud.networkconnectivity.v1alpha1.OperationMetadata * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - PolicyBasedRoute.verify = function verify(message) { + OperationMetadata.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - var properties = {}; - if (message.virtualMachine != null && message.hasOwnProperty("virtualMachine")) { - properties.target = 1; - { - var error = $root.google.cloud.networkconnectivity.v1.PolicyBasedRoute.VirtualMachine.verify(message.virtualMachine); - if (error) - return "virtualMachine." + error; - } - } - if (message.interconnectAttachment != null && message.hasOwnProperty("interconnectAttachment")) { - if (properties.target === 1) - return "target: multiple values"; - properties.target = 1; - { - var error = $root.google.cloud.networkconnectivity.v1.PolicyBasedRoute.InterconnectAttachment.verify(message.interconnectAttachment); - if (error) - return "interconnectAttachment." + error; - } - } - if (message.nextHopIlbIp != null && message.hasOwnProperty("nextHopIlbIp")) { - properties.nextHop = 1; - if (!$util.isString(message.nextHopIlbIp)) - return "nextHopIlbIp: string expected"; - } - if (message.name != null && message.hasOwnProperty("name")) - if (!$util.isString(message.name)) - return "name: string expected"; if (message.createTime != null && message.hasOwnProperty("createTime")) { var error = $root.google.protobuf.Timestamp.verify(message.createTime); if (error) return "createTime." + error; } - if (message.updateTime != null && message.hasOwnProperty("updateTime")) { - var error = $root.google.protobuf.Timestamp.verify(message.updateTime); - if (error) - return "updateTime." + error; - } - if (message.labels != null && message.hasOwnProperty("labels")) { - if (!$util.isObject(message.labels)) - return "labels: object expected"; - var key = Object.keys(message.labels); - for (var i = 0; i < key.length; ++i) - if (!$util.isString(message.labels[key[i]])) - return "labels: string{k:string} expected"; - } - if (message.description != null && message.hasOwnProperty("description")) - if (!$util.isString(message.description)) - return "description: string expected"; - if (message.network != null && message.hasOwnProperty("network")) - if (!$util.isString(message.network)) - return "network: string expected"; - if (message.filter != null && message.hasOwnProperty("filter")) { - var error = $root.google.cloud.networkconnectivity.v1.PolicyBasedRoute.Filter.verify(message.filter); + if (message.endTime != null && message.hasOwnProperty("endTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.endTime); if (error) - return "filter." + error; - } - if (message.priority != null && message.hasOwnProperty("priority")) - if (!$util.isInteger(message.priority)) - return "priority: integer expected"; - if (message.warnings != null && message.hasOwnProperty("warnings")) { - if (!Array.isArray(message.warnings)) - return "warnings: array expected"; - for (var i = 0; i < message.warnings.length; ++i) { - var error = $root.google.cloud.networkconnectivity.v1.PolicyBasedRoute.Warnings.verify(message.warnings[i]); - if (error) - return "warnings." + error; - } + return "endTime." + error; } - if (message.selfLink != null && message.hasOwnProperty("selfLink")) - if (!$util.isString(message.selfLink)) - return "selfLink: string expected"; - if (message.kind != null && message.hasOwnProperty("kind")) - if (!$util.isString(message.kind)) - return "kind: string expected"; + if (message.target != null && message.hasOwnProperty("target")) + if (!$util.isString(message.target)) + return "target: string expected"; + if (message.verb != null && message.hasOwnProperty("verb")) + if (!$util.isString(message.verb)) + return "verb: string expected"; + if (message.statusMessage != null && message.hasOwnProperty("statusMessage")) + if (!$util.isString(message.statusMessage)) + return "statusMessage: string expected"; + if (message.requestedCancellation != null && message.hasOwnProperty("requestedCancellation")) + if (typeof message.requestedCancellation !== "boolean") + return "requestedCancellation: boolean expected"; + if (message.apiVersion != null && message.hasOwnProperty("apiVersion")) + if (!$util.isString(message.apiVersion)) + return "apiVersion: string expected"; return null; }; /** - * Creates a PolicyBasedRoute message from a plain object. Also converts values to their respective internal types. + * Creates an OperationMetadata message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.networkconnectivity.v1.PolicyBasedRoute + * @memberof google.cloud.networkconnectivity.v1alpha1.OperationMetadata * @static * @param {Object.} object Plain object - * @returns {google.cloud.networkconnectivity.v1.PolicyBasedRoute} PolicyBasedRoute + * @returns {google.cloud.networkconnectivity.v1alpha1.OperationMetadata} OperationMetadata */ - PolicyBasedRoute.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.networkconnectivity.v1.PolicyBasedRoute) + OperationMetadata.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.networkconnectivity.v1alpha1.OperationMetadata) return object; - var message = new $root.google.cloud.networkconnectivity.v1.PolicyBasedRoute(); - if (object.virtualMachine != null) { - if (typeof object.virtualMachine !== "object") - throw TypeError(".google.cloud.networkconnectivity.v1.PolicyBasedRoute.virtualMachine: object expected"); - message.virtualMachine = $root.google.cloud.networkconnectivity.v1.PolicyBasedRoute.VirtualMachine.fromObject(object.virtualMachine); - } - if (object.interconnectAttachment != null) { - if (typeof object.interconnectAttachment !== "object") - throw TypeError(".google.cloud.networkconnectivity.v1.PolicyBasedRoute.interconnectAttachment: object expected"); - message.interconnectAttachment = $root.google.cloud.networkconnectivity.v1.PolicyBasedRoute.InterconnectAttachment.fromObject(object.interconnectAttachment); - } - if (object.nextHopIlbIp != null) - message.nextHopIlbIp = String(object.nextHopIlbIp); - if (object.name != null) - message.name = String(object.name); + var message = new $root.google.cloud.networkconnectivity.v1alpha1.OperationMetadata(); if (object.createTime != null) { if (typeof object.createTime !== "object") - throw TypeError(".google.cloud.networkconnectivity.v1.PolicyBasedRoute.createTime: object expected"); + throw TypeError(".google.cloud.networkconnectivity.v1alpha1.OperationMetadata.createTime: object expected"); message.createTime = $root.google.protobuf.Timestamp.fromObject(object.createTime); } - if (object.updateTime != null) { - if (typeof object.updateTime !== "object") - throw TypeError(".google.cloud.networkconnectivity.v1.PolicyBasedRoute.updateTime: object expected"); - message.updateTime = $root.google.protobuf.Timestamp.fromObject(object.updateTime); - } - if (object.labels) { - if (typeof object.labels !== "object") - throw TypeError(".google.cloud.networkconnectivity.v1.PolicyBasedRoute.labels: object expected"); - message.labels = {}; - for (var keys = Object.keys(object.labels), i = 0; i < keys.length; ++i) - message.labels[keys[i]] = String(object.labels[keys[i]]); - } - if (object.description != null) - message.description = String(object.description); - if (object.network != null) - message.network = String(object.network); - if (object.filter != null) { - if (typeof object.filter !== "object") - throw TypeError(".google.cloud.networkconnectivity.v1.PolicyBasedRoute.filter: object expected"); - message.filter = $root.google.cloud.networkconnectivity.v1.PolicyBasedRoute.Filter.fromObject(object.filter); - } - if (object.priority != null) - message.priority = object.priority | 0; - if (object.warnings) { - if (!Array.isArray(object.warnings)) - throw TypeError(".google.cloud.networkconnectivity.v1.PolicyBasedRoute.warnings: array expected"); - message.warnings = []; - for (var i = 0; i < object.warnings.length; ++i) { - if (typeof object.warnings[i] !== "object") - throw TypeError(".google.cloud.networkconnectivity.v1.PolicyBasedRoute.warnings: object expected"); - message.warnings[i] = $root.google.cloud.networkconnectivity.v1.PolicyBasedRoute.Warnings.fromObject(object.warnings[i]); - } + if (object.endTime != null) { + if (typeof object.endTime !== "object") + throw TypeError(".google.cloud.networkconnectivity.v1alpha1.OperationMetadata.endTime: object expected"); + message.endTime = $root.google.protobuf.Timestamp.fromObject(object.endTime); } - if (object.selfLink != null) - message.selfLink = String(object.selfLink); - if (object.kind != null) - message.kind = String(object.kind); + if (object.target != null) + message.target = String(object.target); + if (object.verb != null) + message.verb = String(object.verb); + if (object.statusMessage != null) + message.statusMessage = String(object.statusMessage); + if (object.requestedCancellation != null) + message.requestedCancellation = Boolean(object.requestedCancellation); + if (object.apiVersion != null) + message.apiVersion = String(object.apiVersion); return message; }; /** - * Creates a plain object from a PolicyBasedRoute message. Also converts values to other types if specified. + * Creates a plain object from an OperationMetadata message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.networkconnectivity.v1.PolicyBasedRoute + * @memberof google.cloud.networkconnectivity.v1alpha1.OperationMetadata * @static - * @param {google.cloud.networkconnectivity.v1.PolicyBasedRoute} message PolicyBasedRoute + * @param {google.cloud.networkconnectivity.v1alpha1.OperationMetadata} message OperationMetadata * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - PolicyBasedRoute.toObject = function toObject(message, options) { + OperationMetadata.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.arrays || options.defaults) - object.warnings = []; - if (options.objects || options.defaults) - object.labels = {}; if (options.defaults) { - object.name = ""; object.createTime = null; - object.updateTime = null; - object.description = ""; - object.network = ""; - object.filter = null; - object.priority = 0; - object.selfLink = ""; - object.kind = ""; + object.endTime = null; + object.target = ""; + object.verb = ""; + object.statusMessage = ""; + object.requestedCancellation = false; + object.apiVersion = ""; } - if (message.name != null && message.hasOwnProperty("name")) - object.name = message.name; if (message.createTime != null && message.hasOwnProperty("createTime")) object.createTime = $root.google.protobuf.Timestamp.toObject(message.createTime, options); - if (message.updateTime != null && message.hasOwnProperty("updateTime")) - object.updateTime = $root.google.protobuf.Timestamp.toObject(message.updateTime, options); - var keys2; - if (message.labels && (keys2 = Object.keys(message.labels)).length) { - object.labels = {}; - for (var j = 0; j < keys2.length; ++j) - object.labels[keys2[j]] = message.labels[keys2[j]]; - } - if (message.description != null && message.hasOwnProperty("description")) - object.description = message.description; - if (message.network != null && message.hasOwnProperty("network")) - object.network = message.network; - if (message.interconnectAttachment != null && message.hasOwnProperty("interconnectAttachment")) { - object.interconnectAttachment = $root.google.cloud.networkconnectivity.v1.PolicyBasedRoute.InterconnectAttachment.toObject(message.interconnectAttachment, options); - if (options.oneofs) - object.target = "interconnectAttachment"; - } - if (message.filter != null && message.hasOwnProperty("filter")) - object.filter = $root.google.cloud.networkconnectivity.v1.PolicyBasedRoute.Filter.toObject(message.filter, options); - if (message.priority != null && message.hasOwnProperty("priority")) - object.priority = message.priority; - if (message.nextHopIlbIp != null && message.hasOwnProperty("nextHopIlbIp")) { - object.nextHopIlbIp = message.nextHopIlbIp; - if (options.oneofs) - object.nextHop = "nextHopIlbIp"; - } - if (message.warnings && message.warnings.length) { - object.warnings = []; - for (var j = 0; j < message.warnings.length; ++j) - object.warnings[j] = $root.google.cloud.networkconnectivity.v1.PolicyBasedRoute.Warnings.toObject(message.warnings[j], options); - } - if (message.selfLink != null && message.hasOwnProperty("selfLink")) - object.selfLink = message.selfLink; - if (message.kind != null && message.hasOwnProperty("kind")) - object.kind = message.kind; - if (message.virtualMachine != null && message.hasOwnProperty("virtualMachine")) { - object.virtualMachine = $root.google.cloud.networkconnectivity.v1.PolicyBasedRoute.VirtualMachine.toObject(message.virtualMachine, options); - if (options.oneofs) - object.target = "virtualMachine"; - } + if (message.endTime != null && message.hasOwnProperty("endTime")) + object.endTime = $root.google.protobuf.Timestamp.toObject(message.endTime, options); + if (message.target != null && message.hasOwnProperty("target")) + object.target = message.target; + if (message.verb != null && message.hasOwnProperty("verb")) + object.verb = message.verb; + if (message.statusMessage != null && message.hasOwnProperty("statusMessage")) + object.statusMessage = message.statusMessage; + if (message.requestedCancellation != null && message.hasOwnProperty("requestedCancellation")) + object.requestedCancellation = message.requestedCancellation; + if (message.apiVersion != null && message.hasOwnProperty("apiVersion")) + object.apiVersion = message.apiVersion; return object; }; /** - * Converts this PolicyBasedRoute to JSON. + * Converts this OperationMetadata to JSON. * @function toJSON - * @memberof google.cloud.networkconnectivity.v1.PolicyBasedRoute + * @memberof google.cloud.networkconnectivity.v1alpha1.OperationMetadata * @instance * @returns {Object.} JSON object */ - PolicyBasedRoute.prototype.toJSON = function toJSON() { + OperationMetadata.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; /** - * Gets the default type url for PolicyBasedRoute - * @function getTypeUrl - * @memberof google.cloud.networkconnectivity.v1.PolicyBasedRoute - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - PolicyBasedRoute.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.networkconnectivity.v1.PolicyBasedRoute"; - }; - - PolicyBasedRoute.VirtualMachine = (function() { - - /** - * Properties of a VirtualMachine. - * @memberof google.cloud.networkconnectivity.v1.PolicyBasedRoute - * @interface IVirtualMachine - * @property {Array.|null} [tags] VirtualMachine tags - */ - - /** - * Constructs a new VirtualMachine. - * @memberof google.cloud.networkconnectivity.v1.PolicyBasedRoute - * @classdesc Represents a VirtualMachine. - * @implements IVirtualMachine - * @constructor - * @param {google.cloud.networkconnectivity.v1.PolicyBasedRoute.IVirtualMachine=} [properties] Properties to set - */ - function VirtualMachine(properties) { - this.tags = []; - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * VirtualMachine tags. - * @member {Array.} tags - * @memberof google.cloud.networkconnectivity.v1.PolicyBasedRoute.VirtualMachine - * @instance - */ - VirtualMachine.prototype.tags = $util.emptyArray; - - /** - * Creates a new VirtualMachine instance using the specified properties. - * @function create - * @memberof google.cloud.networkconnectivity.v1.PolicyBasedRoute.VirtualMachine - * @static - * @param {google.cloud.networkconnectivity.v1.PolicyBasedRoute.IVirtualMachine=} [properties] Properties to set - * @returns {google.cloud.networkconnectivity.v1.PolicyBasedRoute.VirtualMachine} VirtualMachine instance - */ - VirtualMachine.create = function create(properties) { - return new VirtualMachine(properties); - }; - - /** - * Encodes the specified VirtualMachine message. Does not implicitly {@link google.cloud.networkconnectivity.v1.PolicyBasedRoute.VirtualMachine.verify|verify} messages. - * @function encode - * @memberof google.cloud.networkconnectivity.v1.PolicyBasedRoute.VirtualMachine - * @static - * @param {google.cloud.networkconnectivity.v1.PolicyBasedRoute.IVirtualMachine} message VirtualMachine message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - VirtualMachine.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.tags != null && message.tags.length) - for (var i = 0; i < message.tags.length; ++i) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.tags[i]); - return writer; - }; - - /** - * Encodes the specified VirtualMachine message, length delimited. Does not implicitly {@link google.cloud.networkconnectivity.v1.PolicyBasedRoute.VirtualMachine.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.networkconnectivity.v1.PolicyBasedRoute.VirtualMachine - * @static - * @param {google.cloud.networkconnectivity.v1.PolicyBasedRoute.IVirtualMachine} message VirtualMachine message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - VirtualMachine.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a VirtualMachine message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.networkconnectivity.v1.PolicyBasedRoute.VirtualMachine - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.networkconnectivity.v1.PolicyBasedRoute.VirtualMachine} VirtualMachine - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - VirtualMachine.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.networkconnectivity.v1.PolicyBasedRoute.VirtualMachine(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - if (!(message.tags && message.tags.length)) - message.tags = []; - message.tags.push(reader.string()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a VirtualMachine message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.networkconnectivity.v1.PolicyBasedRoute.VirtualMachine - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.networkconnectivity.v1.PolicyBasedRoute.VirtualMachine} VirtualMachine - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - VirtualMachine.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a VirtualMachine message. - * @function verify - * @memberof google.cloud.networkconnectivity.v1.PolicyBasedRoute.VirtualMachine - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - VirtualMachine.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.tags != null && message.hasOwnProperty("tags")) { - if (!Array.isArray(message.tags)) - return "tags: array expected"; - for (var i = 0; i < message.tags.length; ++i) - if (!$util.isString(message.tags[i])) - return "tags: string[] expected"; - } - return null; - }; - - /** - * Creates a VirtualMachine message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.networkconnectivity.v1.PolicyBasedRoute.VirtualMachine - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.networkconnectivity.v1.PolicyBasedRoute.VirtualMachine} VirtualMachine - */ - VirtualMachine.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.networkconnectivity.v1.PolicyBasedRoute.VirtualMachine) - return object; - var message = new $root.google.cloud.networkconnectivity.v1.PolicyBasedRoute.VirtualMachine(); - if (object.tags) { - if (!Array.isArray(object.tags)) - throw TypeError(".google.cloud.networkconnectivity.v1.PolicyBasedRoute.VirtualMachine.tags: array expected"); - message.tags = []; - for (var i = 0; i < object.tags.length; ++i) - message.tags[i] = String(object.tags[i]); - } - return message; - }; - - /** - * Creates a plain object from a VirtualMachine message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.networkconnectivity.v1.PolicyBasedRoute.VirtualMachine - * @static - * @param {google.cloud.networkconnectivity.v1.PolicyBasedRoute.VirtualMachine} message VirtualMachine - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - VirtualMachine.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) - object.tags = []; - if (message.tags && message.tags.length) { - object.tags = []; - for (var j = 0; j < message.tags.length; ++j) - object.tags[j] = message.tags[j]; - } - return object; - }; - - /** - * Converts this VirtualMachine to JSON. - * @function toJSON - * @memberof google.cloud.networkconnectivity.v1.PolicyBasedRoute.VirtualMachine - * @instance - * @returns {Object.} JSON object - */ - VirtualMachine.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for VirtualMachine - * @function getTypeUrl - * @memberof google.cloud.networkconnectivity.v1.PolicyBasedRoute.VirtualMachine - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - VirtualMachine.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.networkconnectivity.v1.PolicyBasedRoute.VirtualMachine"; - }; - - return VirtualMachine; - })(); - - PolicyBasedRoute.InterconnectAttachment = (function() { - - /** - * Properties of an InterconnectAttachment. - * @memberof google.cloud.networkconnectivity.v1.PolicyBasedRoute - * @interface IInterconnectAttachment - * @property {string|null} [region] InterconnectAttachment region - */ - - /** - * Constructs a new InterconnectAttachment. - * @memberof google.cloud.networkconnectivity.v1.PolicyBasedRoute - * @classdesc Represents an InterconnectAttachment. - * @implements IInterconnectAttachment - * @constructor - * @param {google.cloud.networkconnectivity.v1.PolicyBasedRoute.IInterconnectAttachment=} [properties] Properties to set - */ - function InterconnectAttachment(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * InterconnectAttachment region. - * @member {string} region - * @memberof google.cloud.networkconnectivity.v1.PolicyBasedRoute.InterconnectAttachment - * @instance - */ - InterconnectAttachment.prototype.region = ""; - - /** - * Creates a new InterconnectAttachment instance using the specified properties. - * @function create - * @memberof google.cloud.networkconnectivity.v1.PolicyBasedRoute.InterconnectAttachment - * @static - * @param {google.cloud.networkconnectivity.v1.PolicyBasedRoute.IInterconnectAttachment=} [properties] Properties to set - * @returns {google.cloud.networkconnectivity.v1.PolicyBasedRoute.InterconnectAttachment} InterconnectAttachment instance - */ - InterconnectAttachment.create = function create(properties) { - return new InterconnectAttachment(properties); - }; - - /** - * Encodes the specified InterconnectAttachment message. Does not implicitly {@link google.cloud.networkconnectivity.v1.PolicyBasedRoute.InterconnectAttachment.verify|verify} messages. - * @function encode - * @memberof google.cloud.networkconnectivity.v1.PolicyBasedRoute.InterconnectAttachment - * @static - * @param {google.cloud.networkconnectivity.v1.PolicyBasedRoute.IInterconnectAttachment} message InterconnectAttachment message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - InterconnectAttachment.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.region != null && Object.hasOwnProperty.call(message, "region")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.region); - return writer; - }; - - /** - * Encodes the specified InterconnectAttachment message, length delimited. Does not implicitly {@link google.cloud.networkconnectivity.v1.PolicyBasedRoute.InterconnectAttachment.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.networkconnectivity.v1.PolicyBasedRoute.InterconnectAttachment - * @static - * @param {google.cloud.networkconnectivity.v1.PolicyBasedRoute.IInterconnectAttachment} message InterconnectAttachment message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - InterconnectAttachment.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an InterconnectAttachment message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.networkconnectivity.v1.PolicyBasedRoute.InterconnectAttachment - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.networkconnectivity.v1.PolicyBasedRoute.InterconnectAttachment} InterconnectAttachment - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - InterconnectAttachment.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.networkconnectivity.v1.PolicyBasedRoute.InterconnectAttachment(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.region = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes an InterconnectAttachment message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.networkconnectivity.v1.PolicyBasedRoute.InterconnectAttachment - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.networkconnectivity.v1.PolicyBasedRoute.InterconnectAttachment} InterconnectAttachment - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - InterconnectAttachment.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an InterconnectAttachment message. - * @function verify - * @memberof google.cloud.networkconnectivity.v1.PolicyBasedRoute.InterconnectAttachment - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - InterconnectAttachment.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.region != null && message.hasOwnProperty("region")) - if (!$util.isString(message.region)) - return "region: string expected"; - return null; - }; - - /** - * Creates an InterconnectAttachment message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.networkconnectivity.v1.PolicyBasedRoute.InterconnectAttachment - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.networkconnectivity.v1.PolicyBasedRoute.InterconnectAttachment} InterconnectAttachment - */ - InterconnectAttachment.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.networkconnectivity.v1.PolicyBasedRoute.InterconnectAttachment) - return object; - var message = new $root.google.cloud.networkconnectivity.v1.PolicyBasedRoute.InterconnectAttachment(); - if (object.region != null) - message.region = String(object.region); - return message; - }; - - /** - * Creates a plain object from an InterconnectAttachment message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.networkconnectivity.v1.PolicyBasedRoute.InterconnectAttachment - * @static - * @param {google.cloud.networkconnectivity.v1.PolicyBasedRoute.InterconnectAttachment} message InterconnectAttachment - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - InterconnectAttachment.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) - object.region = ""; - if (message.region != null && message.hasOwnProperty("region")) - object.region = message.region; - return object; - }; - - /** - * Converts this InterconnectAttachment to JSON. - * @function toJSON - * @memberof google.cloud.networkconnectivity.v1.PolicyBasedRoute.InterconnectAttachment - * @instance - * @returns {Object.} JSON object - */ - InterconnectAttachment.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for InterconnectAttachment - * @function getTypeUrl - * @memberof google.cloud.networkconnectivity.v1.PolicyBasedRoute.InterconnectAttachment - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - InterconnectAttachment.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.networkconnectivity.v1.PolicyBasedRoute.InterconnectAttachment"; - }; - - return InterconnectAttachment; - })(); - - PolicyBasedRoute.Filter = (function() { - - /** - * Properties of a Filter. - * @memberof google.cloud.networkconnectivity.v1.PolicyBasedRoute - * @interface IFilter - * @property {string|null} [ipProtocol] Filter ipProtocol - * @property {string|null} [srcRange] Filter srcRange - * @property {string|null} [destRange] Filter destRange - * @property {google.cloud.networkconnectivity.v1.PolicyBasedRoute.Filter.ProtocolVersion|null} [protocolVersion] Filter protocolVersion - */ - - /** - * Constructs a new Filter. - * @memberof google.cloud.networkconnectivity.v1.PolicyBasedRoute - * @classdesc Represents a Filter. - * @implements IFilter - * @constructor - * @param {google.cloud.networkconnectivity.v1.PolicyBasedRoute.IFilter=} [properties] Properties to set - */ - function Filter(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * Filter ipProtocol. - * @member {string} ipProtocol - * @memberof google.cloud.networkconnectivity.v1.PolicyBasedRoute.Filter - * @instance - */ - Filter.prototype.ipProtocol = ""; - - /** - * Filter srcRange. - * @member {string} srcRange - * @memberof google.cloud.networkconnectivity.v1.PolicyBasedRoute.Filter - * @instance - */ - Filter.prototype.srcRange = ""; - - /** - * Filter destRange. - * @member {string} destRange - * @memberof google.cloud.networkconnectivity.v1.PolicyBasedRoute.Filter - * @instance - */ - Filter.prototype.destRange = ""; - - /** - * Filter protocolVersion. - * @member {google.cloud.networkconnectivity.v1.PolicyBasedRoute.Filter.ProtocolVersion} protocolVersion - * @memberof google.cloud.networkconnectivity.v1.PolicyBasedRoute.Filter - * @instance - */ - Filter.prototype.protocolVersion = 0; - - /** - * Creates a new Filter instance using the specified properties. - * @function create - * @memberof google.cloud.networkconnectivity.v1.PolicyBasedRoute.Filter - * @static - * @param {google.cloud.networkconnectivity.v1.PolicyBasedRoute.IFilter=} [properties] Properties to set - * @returns {google.cloud.networkconnectivity.v1.PolicyBasedRoute.Filter} Filter instance - */ - Filter.create = function create(properties) { - return new Filter(properties); - }; - - /** - * Encodes the specified Filter message. Does not implicitly {@link google.cloud.networkconnectivity.v1.PolicyBasedRoute.Filter.verify|verify} messages. - * @function encode - * @memberof google.cloud.networkconnectivity.v1.PolicyBasedRoute.Filter - * @static - * @param {google.cloud.networkconnectivity.v1.PolicyBasedRoute.IFilter} message Filter message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Filter.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.ipProtocol != null && Object.hasOwnProperty.call(message, "ipProtocol")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.ipProtocol); - if (message.srcRange != null && Object.hasOwnProperty.call(message, "srcRange")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.srcRange); - if (message.destRange != null && Object.hasOwnProperty.call(message, "destRange")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.destRange); - if (message.protocolVersion != null && Object.hasOwnProperty.call(message, "protocolVersion")) - writer.uint32(/* id 6, wireType 0 =*/48).int32(message.protocolVersion); - return writer; - }; - - /** - * Encodes the specified Filter message, length delimited. Does not implicitly {@link google.cloud.networkconnectivity.v1.PolicyBasedRoute.Filter.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.networkconnectivity.v1.PolicyBasedRoute.Filter - * @static - * @param {google.cloud.networkconnectivity.v1.PolicyBasedRoute.IFilter} message Filter message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Filter.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a Filter message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.networkconnectivity.v1.PolicyBasedRoute.Filter - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.networkconnectivity.v1.PolicyBasedRoute.Filter} Filter - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Filter.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.networkconnectivity.v1.PolicyBasedRoute.Filter(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.ipProtocol = reader.string(); - break; - } - case 2: { - message.srcRange = reader.string(); - break; - } - case 3: { - message.destRange = reader.string(); - break; - } - case 6: { - message.protocolVersion = reader.int32(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a Filter message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.networkconnectivity.v1.PolicyBasedRoute.Filter - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.networkconnectivity.v1.PolicyBasedRoute.Filter} Filter - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Filter.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a Filter message. - * @function verify - * @memberof google.cloud.networkconnectivity.v1.PolicyBasedRoute.Filter - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - Filter.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.ipProtocol != null && message.hasOwnProperty("ipProtocol")) - if (!$util.isString(message.ipProtocol)) - return "ipProtocol: string expected"; - if (message.srcRange != null && message.hasOwnProperty("srcRange")) - if (!$util.isString(message.srcRange)) - return "srcRange: string expected"; - if (message.destRange != null && message.hasOwnProperty("destRange")) - if (!$util.isString(message.destRange)) - return "destRange: string expected"; - if (message.protocolVersion != null && message.hasOwnProperty("protocolVersion")) - switch (message.protocolVersion) { - default: - return "protocolVersion: enum value expected"; - case 0: - case 1: - break; - } - return null; - }; - - /** - * Creates a Filter message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.networkconnectivity.v1.PolicyBasedRoute.Filter - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.networkconnectivity.v1.PolicyBasedRoute.Filter} Filter - */ - Filter.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.networkconnectivity.v1.PolicyBasedRoute.Filter) - return object; - var message = new $root.google.cloud.networkconnectivity.v1.PolicyBasedRoute.Filter(); - if (object.ipProtocol != null) - message.ipProtocol = String(object.ipProtocol); - if (object.srcRange != null) - message.srcRange = String(object.srcRange); - if (object.destRange != null) - message.destRange = String(object.destRange); - switch (object.protocolVersion) { - default: - if (typeof object.protocolVersion === "number") { - message.protocolVersion = object.protocolVersion; - break; - } - break; - case "PROTOCOL_VERSION_UNSPECIFIED": - case 0: - message.protocolVersion = 0; - break; - case "IPV4": - case 1: - message.protocolVersion = 1; - break; - } - return message; - }; - - /** - * Creates a plain object from a Filter message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.networkconnectivity.v1.PolicyBasedRoute.Filter - * @static - * @param {google.cloud.networkconnectivity.v1.PolicyBasedRoute.Filter} message Filter - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - Filter.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.ipProtocol = ""; - object.srcRange = ""; - object.destRange = ""; - object.protocolVersion = options.enums === String ? "PROTOCOL_VERSION_UNSPECIFIED" : 0; - } - if (message.ipProtocol != null && message.hasOwnProperty("ipProtocol")) - object.ipProtocol = message.ipProtocol; - if (message.srcRange != null && message.hasOwnProperty("srcRange")) - object.srcRange = message.srcRange; - if (message.destRange != null && message.hasOwnProperty("destRange")) - object.destRange = message.destRange; - if (message.protocolVersion != null && message.hasOwnProperty("protocolVersion")) - object.protocolVersion = options.enums === String ? $root.google.cloud.networkconnectivity.v1.PolicyBasedRoute.Filter.ProtocolVersion[message.protocolVersion] === undefined ? message.protocolVersion : $root.google.cloud.networkconnectivity.v1.PolicyBasedRoute.Filter.ProtocolVersion[message.protocolVersion] : message.protocolVersion; - return object; - }; - - /** - * Converts this Filter to JSON. - * @function toJSON - * @memberof google.cloud.networkconnectivity.v1.PolicyBasedRoute.Filter - * @instance - * @returns {Object.} JSON object - */ - Filter.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for Filter - * @function getTypeUrl - * @memberof google.cloud.networkconnectivity.v1.PolicyBasedRoute.Filter - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - Filter.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.networkconnectivity.v1.PolicyBasedRoute.Filter"; - }; - - /** - * ProtocolVersion enum. - * @name google.cloud.networkconnectivity.v1.PolicyBasedRoute.Filter.ProtocolVersion - * @enum {number} - * @property {number} PROTOCOL_VERSION_UNSPECIFIED=0 PROTOCOL_VERSION_UNSPECIFIED value - * @property {number} IPV4=1 IPV4 value - */ - Filter.ProtocolVersion = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "PROTOCOL_VERSION_UNSPECIFIED"] = 0; - values[valuesById[1] = "IPV4"] = 1; - return values; - })(); - - return Filter; - })(); - - PolicyBasedRoute.Warnings = (function() { - - /** - * Properties of a Warnings. - * @memberof google.cloud.networkconnectivity.v1.PolicyBasedRoute - * @interface IWarnings - * @property {google.cloud.networkconnectivity.v1.PolicyBasedRoute.Warnings.Code|null} [code] Warnings code - * @property {Object.|null} [data] Warnings data - * @property {string|null} [warningMessage] Warnings warningMessage - */ - - /** - * Constructs a new Warnings. - * @memberof google.cloud.networkconnectivity.v1.PolicyBasedRoute - * @classdesc Represents a Warnings. - * @implements IWarnings - * @constructor - * @param {google.cloud.networkconnectivity.v1.PolicyBasedRoute.IWarnings=} [properties] Properties to set - */ - function Warnings(properties) { - this.data = {}; - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * Warnings code. - * @member {google.cloud.networkconnectivity.v1.PolicyBasedRoute.Warnings.Code} code - * @memberof google.cloud.networkconnectivity.v1.PolicyBasedRoute.Warnings - * @instance - */ - Warnings.prototype.code = 0; - - /** - * Warnings data. - * @member {Object.} data - * @memberof google.cloud.networkconnectivity.v1.PolicyBasedRoute.Warnings - * @instance - */ - Warnings.prototype.data = $util.emptyObject; - - /** - * Warnings warningMessage. - * @member {string} warningMessage - * @memberof google.cloud.networkconnectivity.v1.PolicyBasedRoute.Warnings - * @instance - */ - Warnings.prototype.warningMessage = ""; - - /** - * Creates a new Warnings instance using the specified properties. - * @function create - * @memberof google.cloud.networkconnectivity.v1.PolicyBasedRoute.Warnings - * @static - * @param {google.cloud.networkconnectivity.v1.PolicyBasedRoute.IWarnings=} [properties] Properties to set - * @returns {google.cloud.networkconnectivity.v1.PolicyBasedRoute.Warnings} Warnings instance - */ - Warnings.create = function create(properties) { - return new Warnings(properties); - }; - - /** - * Encodes the specified Warnings message. Does not implicitly {@link google.cloud.networkconnectivity.v1.PolicyBasedRoute.Warnings.verify|verify} messages. - * @function encode - * @memberof google.cloud.networkconnectivity.v1.PolicyBasedRoute.Warnings - * @static - * @param {google.cloud.networkconnectivity.v1.PolicyBasedRoute.IWarnings} message Warnings message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Warnings.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.code != null && Object.hasOwnProperty.call(message, "code")) - writer.uint32(/* id 1, wireType 0 =*/8).int32(message.code); - if (message.data != null && Object.hasOwnProperty.call(message, "data")) - for (var keys = Object.keys(message.data), i = 0; i < keys.length; ++i) - writer.uint32(/* id 2, wireType 2 =*/18).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]).uint32(/* id 2, wireType 2 =*/18).string(message.data[keys[i]]).ldelim(); - if (message.warningMessage != null && Object.hasOwnProperty.call(message, "warningMessage")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.warningMessage); - return writer; - }; - - /** - * Encodes the specified Warnings message, length delimited. Does not implicitly {@link google.cloud.networkconnectivity.v1.PolicyBasedRoute.Warnings.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.networkconnectivity.v1.PolicyBasedRoute.Warnings - * @static - * @param {google.cloud.networkconnectivity.v1.PolicyBasedRoute.IWarnings} message Warnings message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Warnings.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a Warnings message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.networkconnectivity.v1.PolicyBasedRoute.Warnings - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.networkconnectivity.v1.PolicyBasedRoute.Warnings} Warnings - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Warnings.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.networkconnectivity.v1.PolicyBasedRoute.Warnings(), key, value; - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.code = reader.int32(); - break; - } - case 2: { - if (message.data === $util.emptyObject) - message.data = {}; - var end2 = reader.uint32() + reader.pos; - key = ""; - value = ""; - while (reader.pos < end2) { - var tag2 = reader.uint32(); - switch (tag2 >>> 3) { - case 1: - key = reader.string(); - break; - case 2: - value = reader.string(); - break; - default: - reader.skipType(tag2 & 7); - break; - } - } - message.data[key] = value; - break; - } - case 3: { - message.warningMessage = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a Warnings message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.networkconnectivity.v1.PolicyBasedRoute.Warnings - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.networkconnectivity.v1.PolicyBasedRoute.Warnings} Warnings - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Warnings.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a Warnings message. - * @function verify - * @memberof google.cloud.networkconnectivity.v1.PolicyBasedRoute.Warnings - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - Warnings.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.code != null && message.hasOwnProperty("code")) - switch (message.code) { - default: - return "code: enum value expected"; - case 0: - case 1: - case 2: - break; - } - if (message.data != null && message.hasOwnProperty("data")) { - if (!$util.isObject(message.data)) - return "data: object expected"; - var key = Object.keys(message.data); - for (var i = 0; i < key.length; ++i) - if (!$util.isString(message.data[key[i]])) - return "data: string{k:string} expected"; - } - if (message.warningMessage != null && message.hasOwnProperty("warningMessage")) - if (!$util.isString(message.warningMessage)) - return "warningMessage: string expected"; - return null; - }; - - /** - * Creates a Warnings message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.networkconnectivity.v1.PolicyBasedRoute.Warnings - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.networkconnectivity.v1.PolicyBasedRoute.Warnings} Warnings - */ - Warnings.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.networkconnectivity.v1.PolicyBasedRoute.Warnings) - return object; - var message = new $root.google.cloud.networkconnectivity.v1.PolicyBasedRoute.Warnings(); - switch (object.code) { - default: - if (typeof object.code === "number") { - message.code = object.code; - break; - } - break; - case "WARNING_UNSPECIFIED": - case 0: - message.code = 0; - break; - case "RESOURCE_NOT_ACTIVE": - case 1: - message.code = 1; - break; - case "RESOURCE_BEING_MODIFIED": - case 2: - message.code = 2; - break; - } - if (object.data) { - if (typeof object.data !== "object") - throw TypeError(".google.cloud.networkconnectivity.v1.PolicyBasedRoute.Warnings.data: object expected"); - message.data = {}; - for (var keys = Object.keys(object.data), i = 0; i < keys.length; ++i) - message.data[keys[i]] = String(object.data[keys[i]]); - } - if (object.warningMessage != null) - message.warningMessage = String(object.warningMessage); - return message; - }; - - /** - * Creates a plain object from a Warnings message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.networkconnectivity.v1.PolicyBasedRoute.Warnings - * @static - * @param {google.cloud.networkconnectivity.v1.PolicyBasedRoute.Warnings} message Warnings - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - Warnings.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.objects || options.defaults) - object.data = {}; - if (options.defaults) { - object.code = options.enums === String ? "WARNING_UNSPECIFIED" : 0; - object.warningMessage = ""; - } - if (message.code != null && message.hasOwnProperty("code")) - object.code = options.enums === String ? $root.google.cloud.networkconnectivity.v1.PolicyBasedRoute.Warnings.Code[message.code] === undefined ? message.code : $root.google.cloud.networkconnectivity.v1.PolicyBasedRoute.Warnings.Code[message.code] : message.code; - var keys2; - if (message.data && (keys2 = Object.keys(message.data)).length) { - object.data = {}; - for (var j = 0; j < keys2.length; ++j) - object.data[keys2[j]] = message.data[keys2[j]]; - } - if (message.warningMessage != null && message.hasOwnProperty("warningMessage")) - object.warningMessage = message.warningMessage; - return object; - }; - - /** - * Converts this Warnings to JSON. - * @function toJSON - * @memberof google.cloud.networkconnectivity.v1.PolicyBasedRoute.Warnings - * @instance - * @returns {Object.} JSON object - */ - Warnings.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for Warnings - * @function getTypeUrl - * @memberof google.cloud.networkconnectivity.v1.PolicyBasedRoute.Warnings - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - Warnings.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.networkconnectivity.v1.PolicyBasedRoute.Warnings"; - }; - - /** - * Code enum. - * @name google.cloud.networkconnectivity.v1.PolicyBasedRoute.Warnings.Code - * @enum {number} - * @property {number} WARNING_UNSPECIFIED=0 WARNING_UNSPECIFIED value - * @property {number} RESOURCE_NOT_ACTIVE=1 RESOURCE_NOT_ACTIVE value - * @property {number} RESOURCE_BEING_MODIFIED=2 RESOURCE_BEING_MODIFIED value - */ - Warnings.Code = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "WARNING_UNSPECIFIED"] = 0; - values[valuesById[1] = "RESOURCE_NOT_ACTIVE"] = 1; - values[valuesById[2] = "RESOURCE_BEING_MODIFIED"] = 2; - return values; - })(); - - return Warnings; - })(); - - return PolicyBasedRoute; - })(); - - v1.ListPolicyBasedRoutesRequest = (function() { - - /** - * Properties of a ListPolicyBasedRoutesRequest. - * @memberof google.cloud.networkconnectivity.v1 - * @interface IListPolicyBasedRoutesRequest - * @property {string|null} [parent] ListPolicyBasedRoutesRequest parent - * @property {number|null} [pageSize] ListPolicyBasedRoutesRequest pageSize - * @property {string|null} [pageToken] ListPolicyBasedRoutesRequest pageToken - * @property {string|null} [filter] ListPolicyBasedRoutesRequest filter - * @property {string|null} [orderBy] ListPolicyBasedRoutesRequest orderBy - */ - - /** - * Constructs a new ListPolicyBasedRoutesRequest. - * @memberof google.cloud.networkconnectivity.v1 - * @classdesc Represents a ListPolicyBasedRoutesRequest. - * @implements IListPolicyBasedRoutesRequest - * @constructor - * @param {google.cloud.networkconnectivity.v1.IListPolicyBasedRoutesRequest=} [properties] Properties to set - */ - function ListPolicyBasedRoutesRequest(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * ListPolicyBasedRoutesRequest parent. - * @member {string} parent - * @memberof google.cloud.networkconnectivity.v1.ListPolicyBasedRoutesRequest - * @instance - */ - ListPolicyBasedRoutesRequest.prototype.parent = ""; - - /** - * ListPolicyBasedRoutesRequest pageSize. - * @member {number} pageSize - * @memberof google.cloud.networkconnectivity.v1.ListPolicyBasedRoutesRequest - * @instance - */ - ListPolicyBasedRoutesRequest.prototype.pageSize = 0; - - /** - * ListPolicyBasedRoutesRequest pageToken. - * @member {string} pageToken - * @memberof google.cloud.networkconnectivity.v1.ListPolicyBasedRoutesRequest - * @instance - */ - ListPolicyBasedRoutesRequest.prototype.pageToken = ""; - - /** - * ListPolicyBasedRoutesRequest filter. - * @member {string} filter - * @memberof google.cloud.networkconnectivity.v1.ListPolicyBasedRoutesRequest - * @instance - */ - ListPolicyBasedRoutesRequest.prototype.filter = ""; - - /** - * ListPolicyBasedRoutesRequest orderBy. - * @member {string} orderBy - * @memberof google.cloud.networkconnectivity.v1.ListPolicyBasedRoutesRequest - * @instance - */ - ListPolicyBasedRoutesRequest.prototype.orderBy = ""; - - /** - * Creates a new ListPolicyBasedRoutesRequest instance using the specified properties. - * @function create - * @memberof google.cloud.networkconnectivity.v1.ListPolicyBasedRoutesRequest - * @static - * @param {google.cloud.networkconnectivity.v1.IListPolicyBasedRoutesRequest=} [properties] Properties to set - * @returns {google.cloud.networkconnectivity.v1.ListPolicyBasedRoutesRequest} ListPolicyBasedRoutesRequest instance - */ - ListPolicyBasedRoutesRequest.create = function create(properties) { - return new ListPolicyBasedRoutesRequest(properties); - }; - - /** - * Encodes the specified ListPolicyBasedRoutesRequest message. Does not implicitly {@link google.cloud.networkconnectivity.v1.ListPolicyBasedRoutesRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.networkconnectivity.v1.ListPolicyBasedRoutesRequest - * @static - * @param {google.cloud.networkconnectivity.v1.IListPolicyBasedRoutesRequest} message ListPolicyBasedRoutesRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ListPolicyBasedRoutesRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); - if (message.pageSize != null && Object.hasOwnProperty.call(message, "pageSize")) - writer.uint32(/* id 2, wireType 0 =*/16).int32(message.pageSize); - if (message.pageToken != null && Object.hasOwnProperty.call(message, "pageToken")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.pageToken); - if (message.filter != null && Object.hasOwnProperty.call(message, "filter")) - writer.uint32(/* id 4, wireType 2 =*/34).string(message.filter); - if (message.orderBy != null && Object.hasOwnProperty.call(message, "orderBy")) - writer.uint32(/* id 5, wireType 2 =*/42).string(message.orderBy); - return writer; - }; - - /** - * Encodes the specified ListPolicyBasedRoutesRequest message, length delimited. Does not implicitly {@link google.cloud.networkconnectivity.v1.ListPolicyBasedRoutesRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.networkconnectivity.v1.ListPolicyBasedRoutesRequest - * @static - * @param {google.cloud.networkconnectivity.v1.IListPolicyBasedRoutesRequest} message ListPolicyBasedRoutesRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ListPolicyBasedRoutesRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a ListPolicyBasedRoutesRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.networkconnectivity.v1.ListPolicyBasedRoutesRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.networkconnectivity.v1.ListPolicyBasedRoutesRequest} ListPolicyBasedRoutesRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ListPolicyBasedRoutesRequest.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.networkconnectivity.v1.ListPolicyBasedRoutesRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.parent = reader.string(); - break; - } - case 2: { - message.pageSize = reader.int32(); - break; - } - case 3: { - message.pageToken = reader.string(); - break; - } - case 4: { - message.filter = reader.string(); - break; - } - case 5: { - message.orderBy = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a ListPolicyBasedRoutesRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.networkconnectivity.v1.ListPolicyBasedRoutesRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.networkconnectivity.v1.ListPolicyBasedRoutesRequest} ListPolicyBasedRoutesRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ListPolicyBasedRoutesRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a ListPolicyBasedRoutesRequest message. - * @function verify - * @memberof google.cloud.networkconnectivity.v1.ListPolicyBasedRoutesRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - ListPolicyBasedRoutesRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.parent != null && message.hasOwnProperty("parent")) - if (!$util.isString(message.parent)) - return "parent: string expected"; - if (message.pageSize != null && message.hasOwnProperty("pageSize")) - if (!$util.isInteger(message.pageSize)) - return "pageSize: integer expected"; - if (message.pageToken != null && message.hasOwnProperty("pageToken")) - if (!$util.isString(message.pageToken)) - return "pageToken: string expected"; - if (message.filter != null && message.hasOwnProperty("filter")) - if (!$util.isString(message.filter)) - return "filter: string expected"; - if (message.orderBy != null && message.hasOwnProperty("orderBy")) - if (!$util.isString(message.orderBy)) - return "orderBy: string expected"; - return null; - }; - - /** - * Creates a ListPolicyBasedRoutesRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.networkconnectivity.v1.ListPolicyBasedRoutesRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.networkconnectivity.v1.ListPolicyBasedRoutesRequest} ListPolicyBasedRoutesRequest - */ - ListPolicyBasedRoutesRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.networkconnectivity.v1.ListPolicyBasedRoutesRequest) - return object; - var message = new $root.google.cloud.networkconnectivity.v1.ListPolicyBasedRoutesRequest(); - if (object.parent != null) - message.parent = String(object.parent); - if (object.pageSize != null) - message.pageSize = object.pageSize | 0; - if (object.pageToken != null) - message.pageToken = String(object.pageToken); - if (object.filter != null) - message.filter = String(object.filter); - if (object.orderBy != null) - message.orderBy = String(object.orderBy); - return message; - }; - - /** - * Creates a plain object from a ListPolicyBasedRoutesRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.networkconnectivity.v1.ListPolicyBasedRoutesRequest - * @static - * @param {google.cloud.networkconnectivity.v1.ListPolicyBasedRoutesRequest} message ListPolicyBasedRoutesRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - ListPolicyBasedRoutesRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.parent = ""; - object.pageSize = 0; - object.pageToken = ""; - object.filter = ""; - object.orderBy = ""; - } - if (message.parent != null && message.hasOwnProperty("parent")) - object.parent = message.parent; - if (message.pageSize != null && message.hasOwnProperty("pageSize")) - object.pageSize = message.pageSize; - if (message.pageToken != null && message.hasOwnProperty("pageToken")) - object.pageToken = message.pageToken; - if (message.filter != null && message.hasOwnProperty("filter")) - object.filter = message.filter; - if (message.orderBy != null && message.hasOwnProperty("orderBy")) - object.orderBy = message.orderBy; - return object; - }; - - /** - * Converts this ListPolicyBasedRoutesRequest to JSON. - * @function toJSON - * @memberof google.cloud.networkconnectivity.v1.ListPolicyBasedRoutesRequest - * @instance - * @returns {Object.} JSON object - */ - ListPolicyBasedRoutesRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for ListPolicyBasedRoutesRequest - * @function getTypeUrl - * @memberof google.cloud.networkconnectivity.v1.ListPolicyBasedRoutesRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - ListPolicyBasedRoutesRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.networkconnectivity.v1.ListPolicyBasedRoutesRequest"; - }; - - return ListPolicyBasedRoutesRequest; - })(); - - v1.ListPolicyBasedRoutesResponse = (function() { - - /** - * Properties of a ListPolicyBasedRoutesResponse. - * @memberof google.cloud.networkconnectivity.v1 - * @interface IListPolicyBasedRoutesResponse - * @property {Array.|null} [policyBasedRoutes] ListPolicyBasedRoutesResponse policyBasedRoutes - * @property {string|null} [nextPageToken] ListPolicyBasedRoutesResponse nextPageToken - * @property {Array.|null} [unreachable] ListPolicyBasedRoutesResponse unreachable - */ - - /** - * Constructs a new ListPolicyBasedRoutesResponse. - * @memberof google.cloud.networkconnectivity.v1 - * @classdesc Represents a ListPolicyBasedRoutesResponse. - * @implements IListPolicyBasedRoutesResponse - * @constructor - * @param {google.cloud.networkconnectivity.v1.IListPolicyBasedRoutesResponse=} [properties] Properties to set - */ - function ListPolicyBasedRoutesResponse(properties) { - this.policyBasedRoutes = []; - this.unreachable = []; - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * ListPolicyBasedRoutesResponse policyBasedRoutes. - * @member {Array.} policyBasedRoutes - * @memberof google.cloud.networkconnectivity.v1.ListPolicyBasedRoutesResponse - * @instance - */ - ListPolicyBasedRoutesResponse.prototype.policyBasedRoutes = $util.emptyArray; - - /** - * ListPolicyBasedRoutesResponse nextPageToken. - * @member {string} nextPageToken - * @memberof google.cloud.networkconnectivity.v1.ListPolicyBasedRoutesResponse - * @instance - */ - ListPolicyBasedRoutesResponse.prototype.nextPageToken = ""; - - /** - * ListPolicyBasedRoutesResponse unreachable. - * @member {Array.} unreachable - * @memberof google.cloud.networkconnectivity.v1.ListPolicyBasedRoutesResponse - * @instance - */ - ListPolicyBasedRoutesResponse.prototype.unreachable = $util.emptyArray; - - /** - * Creates a new ListPolicyBasedRoutesResponse instance using the specified properties. - * @function create - * @memberof google.cloud.networkconnectivity.v1.ListPolicyBasedRoutesResponse - * @static - * @param {google.cloud.networkconnectivity.v1.IListPolicyBasedRoutesResponse=} [properties] Properties to set - * @returns {google.cloud.networkconnectivity.v1.ListPolicyBasedRoutesResponse} ListPolicyBasedRoutesResponse instance - */ - ListPolicyBasedRoutesResponse.create = function create(properties) { - return new ListPolicyBasedRoutesResponse(properties); - }; - - /** - * Encodes the specified ListPolicyBasedRoutesResponse message. Does not implicitly {@link google.cloud.networkconnectivity.v1.ListPolicyBasedRoutesResponse.verify|verify} messages. - * @function encode - * @memberof google.cloud.networkconnectivity.v1.ListPolicyBasedRoutesResponse - * @static - * @param {google.cloud.networkconnectivity.v1.IListPolicyBasedRoutesResponse} message ListPolicyBasedRoutesResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ListPolicyBasedRoutesResponse.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.policyBasedRoutes != null && message.policyBasedRoutes.length) - for (var i = 0; i < message.policyBasedRoutes.length; ++i) - $root.google.cloud.networkconnectivity.v1.PolicyBasedRoute.encode(message.policyBasedRoutes[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.nextPageToken != null && Object.hasOwnProperty.call(message, "nextPageToken")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.nextPageToken); - if (message.unreachable != null && message.unreachable.length) - for (var i = 0; i < message.unreachable.length; ++i) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.unreachable[i]); - return writer; - }; - - /** - * Encodes the specified ListPolicyBasedRoutesResponse message, length delimited. Does not implicitly {@link google.cloud.networkconnectivity.v1.ListPolicyBasedRoutesResponse.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.networkconnectivity.v1.ListPolicyBasedRoutesResponse - * @static - * @param {google.cloud.networkconnectivity.v1.IListPolicyBasedRoutesResponse} message ListPolicyBasedRoutesResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ListPolicyBasedRoutesResponse.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a ListPolicyBasedRoutesResponse message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.networkconnectivity.v1.ListPolicyBasedRoutesResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.networkconnectivity.v1.ListPolicyBasedRoutesResponse} ListPolicyBasedRoutesResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ListPolicyBasedRoutesResponse.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.networkconnectivity.v1.ListPolicyBasedRoutesResponse(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - if (!(message.policyBasedRoutes && message.policyBasedRoutes.length)) - message.policyBasedRoutes = []; - message.policyBasedRoutes.push($root.google.cloud.networkconnectivity.v1.PolicyBasedRoute.decode(reader, reader.uint32())); - break; - } - case 2: { - message.nextPageToken = reader.string(); - break; - } - case 3: { - if (!(message.unreachable && message.unreachable.length)) - message.unreachable = []; - message.unreachable.push(reader.string()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a ListPolicyBasedRoutesResponse message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.networkconnectivity.v1.ListPolicyBasedRoutesResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.networkconnectivity.v1.ListPolicyBasedRoutesResponse} ListPolicyBasedRoutesResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ListPolicyBasedRoutesResponse.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a ListPolicyBasedRoutesResponse message. - * @function verify - * @memberof google.cloud.networkconnectivity.v1.ListPolicyBasedRoutesResponse - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - ListPolicyBasedRoutesResponse.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.policyBasedRoutes != null && message.hasOwnProperty("policyBasedRoutes")) { - if (!Array.isArray(message.policyBasedRoutes)) - return "policyBasedRoutes: array expected"; - for (var i = 0; i < message.policyBasedRoutes.length; ++i) { - var error = $root.google.cloud.networkconnectivity.v1.PolicyBasedRoute.verify(message.policyBasedRoutes[i]); - if (error) - return "policyBasedRoutes." + error; - } - } - if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) - if (!$util.isString(message.nextPageToken)) - return "nextPageToken: string expected"; - if (message.unreachable != null && message.hasOwnProperty("unreachable")) { - if (!Array.isArray(message.unreachable)) - return "unreachable: array expected"; - for (var i = 0; i < message.unreachable.length; ++i) - if (!$util.isString(message.unreachable[i])) - return "unreachable: string[] expected"; - } - return null; - }; - - /** - * Creates a ListPolicyBasedRoutesResponse message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.networkconnectivity.v1.ListPolicyBasedRoutesResponse - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.networkconnectivity.v1.ListPolicyBasedRoutesResponse} ListPolicyBasedRoutesResponse - */ - ListPolicyBasedRoutesResponse.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.networkconnectivity.v1.ListPolicyBasedRoutesResponse) - return object; - var message = new $root.google.cloud.networkconnectivity.v1.ListPolicyBasedRoutesResponse(); - if (object.policyBasedRoutes) { - if (!Array.isArray(object.policyBasedRoutes)) - throw TypeError(".google.cloud.networkconnectivity.v1.ListPolicyBasedRoutesResponse.policyBasedRoutes: array expected"); - message.policyBasedRoutes = []; - for (var i = 0; i < object.policyBasedRoutes.length; ++i) { - if (typeof object.policyBasedRoutes[i] !== "object") - throw TypeError(".google.cloud.networkconnectivity.v1.ListPolicyBasedRoutesResponse.policyBasedRoutes: object expected"); - message.policyBasedRoutes[i] = $root.google.cloud.networkconnectivity.v1.PolicyBasedRoute.fromObject(object.policyBasedRoutes[i]); - } - } - if (object.nextPageToken != null) - message.nextPageToken = String(object.nextPageToken); - if (object.unreachable) { - if (!Array.isArray(object.unreachable)) - throw TypeError(".google.cloud.networkconnectivity.v1.ListPolicyBasedRoutesResponse.unreachable: array expected"); - message.unreachable = []; - for (var i = 0; i < object.unreachable.length; ++i) - message.unreachable[i] = String(object.unreachable[i]); - } - return message; - }; - - /** - * Creates a plain object from a ListPolicyBasedRoutesResponse message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.networkconnectivity.v1.ListPolicyBasedRoutesResponse - * @static - * @param {google.cloud.networkconnectivity.v1.ListPolicyBasedRoutesResponse} message ListPolicyBasedRoutesResponse - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - ListPolicyBasedRoutesResponse.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) { - object.policyBasedRoutes = []; - object.unreachable = []; - } - if (options.defaults) - object.nextPageToken = ""; - if (message.policyBasedRoutes && message.policyBasedRoutes.length) { - object.policyBasedRoutes = []; - for (var j = 0; j < message.policyBasedRoutes.length; ++j) - object.policyBasedRoutes[j] = $root.google.cloud.networkconnectivity.v1.PolicyBasedRoute.toObject(message.policyBasedRoutes[j], options); - } - if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) - object.nextPageToken = message.nextPageToken; - if (message.unreachable && message.unreachable.length) { - object.unreachable = []; - for (var j = 0; j < message.unreachable.length; ++j) - object.unreachable[j] = message.unreachable[j]; - } - return object; - }; - - /** - * Converts this ListPolicyBasedRoutesResponse to JSON. - * @function toJSON - * @memberof google.cloud.networkconnectivity.v1.ListPolicyBasedRoutesResponse - * @instance - * @returns {Object.} JSON object - */ - ListPolicyBasedRoutesResponse.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for ListPolicyBasedRoutesResponse - * @function getTypeUrl - * @memberof google.cloud.networkconnectivity.v1.ListPolicyBasedRoutesResponse - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - ListPolicyBasedRoutesResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.networkconnectivity.v1.ListPolicyBasedRoutesResponse"; - }; - - return ListPolicyBasedRoutesResponse; - })(); - - v1.GetPolicyBasedRouteRequest = (function() { - - /** - * Properties of a GetPolicyBasedRouteRequest. - * @memberof google.cloud.networkconnectivity.v1 - * @interface IGetPolicyBasedRouteRequest - * @property {string|null} [name] GetPolicyBasedRouteRequest name - */ - - /** - * Constructs a new GetPolicyBasedRouteRequest. - * @memberof google.cloud.networkconnectivity.v1 - * @classdesc Represents a GetPolicyBasedRouteRequest. - * @implements IGetPolicyBasedRouteRequest - * @constructor - * @param {google.cloud.networkconnectivity.v1.IGetPolicyBasedRouteRequest=} [properties] Properties to set - */ - function GetPolicyBasedRouteRequest(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * GetPolicyBasedRouteRequest name. - * @member {string} name - * @memberof google.cloud.networkconnectivity.v1.GetPolicyBasedRouteRequest - * @instance - */ - GetPolicyBasedRouteRequest.prototype.name = ""; - - /** - * Creates a new GetPolicyBasedRouteRequest instance using the specified properties. - * @function create - * @memberof google.cloud.networkconnectivity.v1.GetPolicyBasedRouteRequest - * @static - * @param {google.cloud.networkconnectivity.v1.IGetPolicyBasedRouteRequest=} [properties] Properties to set - * @returns {google.cloud.networkconnectivity.v1.GetPolicyBasedRouteRequest} GetPolicyBasedRouteRequest instance - */ - GetPolicyBasedRouteRequest.create = function create(properties) { - return new GetPolicyBasedRouteRequest(properties); - }; - - /** - * Encodes the specified GetPolicyBasedRouteRequest message. Does not implicitly {@link google.cloud.networkconnectivity.v1.GetPolicyBasedRouteRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.networkconnectivity.v1.GetPolicyBasedRouteRequest - * @static - * @param {google.cloud.networkconnectivity.v1.IGetPolicyBasedRouteRequest} message GetPolicyBasedRouteRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - GetPolicyBasedRouteRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.name != null && Object.hasOwnProperty.call(message, "name")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); - return writer; - }; - - /** - * Encodes the specified GetPolicyBasedRouteRequest message, length delimited. Does not implicitly {@link google.cloud.networkconnectivity.v1.GetPolicyBasedRouteRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.networkconnectivity.v1.GetPolicyBasedRouteRequest - * @static - * @param {google.cloud.networkconnectivity.v1.IGetPolicyBasedRouteRequest} message GetPolicyBasedRouteRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - GetPolicyBasedRouteRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a GetPolicyBasedRouteRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.networkconnectivity.v1.GetPolicyBasedRouteRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.networkconnectivity.v1.GetPolicyBasedRouteRequest} GetPolicyBasedRouteRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - GetPolicyBasedRouteRequest.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.networkconnectivity.v1.GetPolicyBasedRouteRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.name = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a GetPolicyBasedRouteRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.networkconnectivity.v1.GetPolicyBasedRouteRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.networkconnectivity.v1.GetPolicyBasedRouteRequest} GetPolicyBasedRouteRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - GetPolicyBasedRouteRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a GetPolicyBasedRouteRequest message. - * @function verify - * @memberof google.cloud.networkconnectivity.v1.GetPolicyBasedRouteRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - GetPolicyBasedRouteRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.name != null && message.hasOwnProperty("name")) - if (!$util.isString(message.name)) - return "name: string expected"; - return null; - }; - - /** - * Creates a GetPolicyBasedRouteRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.networkconnectivity.v1.GetPolicyBasedRouteRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.networkconnectivity.v1.GetPolicyBasedRouteRequest} GetPolicyBasedRouteRequest - */ - GetPolicyBasedRouteRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.networkconnectivity.v1.GetPolicyBasedRouteRequest) - return object; - var message = new $root.google.cloud.networkconnectivity.v1.GetPolicyBasedRouteRequest(); - if (object.name != null) - message.name = String(object.name); - return message; - }; - - /** - * Creates a plain object from a GetPolicyBasedRouteRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.networkconnectivity.v1.GetPolicyBasedRouteRequest - * @static - * @param {google.cloud.networkconnectivity.v1.GetPolicyBasedRouteRequest} message GetPolicyBasedRouteRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - GetPolicyBasedRouteRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) - object.name = ""; - if (message.name != null && message.hasOwnProperty("name")) - object.name = message.name; - return object; - }; - - /** - * Converts this GetPolicyBasedRouteRequest to JSON. - * @function toJSON - * @memberof google.cloud.networkconnectivity.v1.GetPolicyBasedRouteRequest - * @instance - * @returns {Object.} JSON object - */ - GetPolicyBasedRouteRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for GetPolicyBasedRouteRequest - * @function getTypeUrl - * @memberof google.cloud.networkconnectivity.v1.GetPolicyBasedRouteRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - GetPolicyBasedRouteRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.networkconnectivity.v1.GetPolicyBasedRouteRequest"; - }; - - return GetPolicyBasedRouteRequest; - })(); - - v1.CreatePolicyBasedRouteRequest = (function() { - - /** - * Properties of a CreatePolicyBasedRouteRequest. - * @memberof google.cloud.networkconnectivity.v1 - * @interface ICreatePolicyBasedRouteRequest - * @property {string|null} [parent] CreatePolicyBasedRouteRequest parent - * @property {string|null} [policyBasedRouteId] CreatePolicyBasedRouteRequest policyBasedRouteId - * @property {google.cloud.networkconnectivity.v1.IPolicyBasedRoute|null} [policyBasedRoute] CreatePolicyBasedRouteRequest policyBasedRoute - * @property {string|null} [requestId] CreatePolicyBasedRouteRequest requestId - */ - - /** - * Constructs a new CreatePolicyBasedRouteRequest. - * @memberof google.cloud.networkconnectivity.v1 - * @classdesc Represents a CreatePolicyBasedRouteRequest. - * @implements ICreatePolicyBasedRouteRequest - * @constructor - * @param {google.cloud.networkconnectivity.v1.ICreatePolicyBasedRouteRequest=} [properties] Properties to set - */ - function CreatePolicyBasedRouteRequest(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * CreatePolicyBasedRouteRequest parent. - * @member {string} parent - * @memberof google.cloud.networkconnectivity.v1.CreatePolicyBasedRouteRequest - * @instance - */ - CreatePolicyBasedRouteRequest.prototype.parent = ""; - - /** - * CreatePolicyBasedRouteRequest policyBasedRouteId. - * @member {string} policyBasedRouteId - * @memberof google.cloud.networkconnectivity.v1.CreatePolicyBasedRouteRequest - * @instance - */ - CreatePolicyBasedRouteRequest.prototype.policyBasedRouteId = ""; - - /** - * CreatePolicyBasedRouteRequest policyBasedRoute. - * @member {google.cloud.networkconnectivity.v1.IPolicyBasedRoute|null|undefined} policyBasedRoute - * @memberof google.cloud.networkconnectivity.v1.CreatePolicyBasedRouteRequest - * @instance - */ - CreatePolicyBasedRouteRequest.prototype.policyBasedRoute = null; - - /** - * CreatePolicyBasedRouteRequest requestId. - * @member {string} requestId - * @memberof google.cloud.networkconnectivity.v1.CreatePolicyBasedRouteRequest - * @instance - */ - CreatePolicyBasedRouteRequest.prototype.requestId = ""; - - /** - * Creates a new CreatePolicyBasedRouteRequest instance using the specified properties. - * @function create - * @memberof google.cloud.networkconnectivity.v1.CreatePolicyBasedRouteRequest - * @static - * @param {google.cloud.networkconnectivity.v1.ICreatePolicyBasedRouteRequest=} [properties] Properties to set - * @returns {google.cloud.networkconnectivity.v1.CreatePolicyBasedRouteRequest} CreatePolicyBasedRouteRequest instance - */ - CreatePolicyBasedRouteRequest.create = function create(properties) { - return new CreatePolicyBasedRouteRequest(properties); - }; - - /** - * Encodes the specified CreatePolicyBasedRouteRequest message. Does not implicitly {@link google.cloud.networkconnectivity.v1.CreatePolicyBasedRouteRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.networkconnectivity.v1.CreatePolicyBasedRouteRequest - * @static - * @param {google.cloud.networkconnectivity.v1.ICreatePolicyBasedRouteRequest} message CreatePolicyBasedRouteRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - CreatePolicyBasedRouteRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); - if (message.policyBasedRouteId != null && Object.hasOwnProperty.call(message, "policyBasedRouteId")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.policyBasedRouteId); - if (message.policyBasedRoute != null && Object.hasOwnProperty.call(message, "policyBasedRoute")) - $root.google.cloud.networkconnectivity.v1.PolicyBasedRoute.encode(message.policyBasedRoute, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - if (message.requestId != null && Object.hasOwnProperty.call(message, "requestId")) - writer.uint32(/* id 4, wireType 2 =*/34).string(message.requestId); - return writer; - }; - - /** - * Encodes the specified CreatePolicyBasedRouteRequest message, length delimited. Does not implicitly {@link google.cloud.networkconnectivity.v1.CreatePolicyBasedRouteRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.networkconnectivity.v1.CreatePolicyBasedRouteRequest - * @static - * @param {google.cloud.networkconnectivity.v1.ICreatePolicyBasedRouteRequest} message CreatePolicyBasedRouteRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - CreatePolicyBasedRouteRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a CreatePolicyBasedRouteRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.networkconnectivity.v1.CreatePolicyBasedRouteRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.networkconnectivity.v1.CreatePolicyBasedRouteRequest} CreatePolicyBasedRouteRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - CreatePolicyBasedRouteRequest.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.networkconnectivity.v1.CreatePolicyBasedRouteRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.parent = reader.string(); - break; - } - case 2: { - message.policyBasedRouteId = reader.string(); - break; - } - case 3: { - message.policyBasedRoute = $root.google.cloud.networkconnectivity.v1.PolicyBasedRoute.decode(reader, reader.uint32()); - break; - } - case 4: { - message.requestId = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a CreatePolicyBasedRouteRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.networkconnectivity.v1.CreatePolicyBasedRouteRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.networkconnectivity.v1.CreatePolicyBasedRouteRequest} CreatePolicyBasedRouteRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - CreatePolicyBasedRouteRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a CreatePolicyBasedRouteRequest message. - * @function verify - * @memberof google.cloud.networkconnectivity.v1.CreatePolicyBasedRouteRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - CreatePolicyBasedRouteRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.parent != null && message.hasOwnProperty("parent")) - if (!$util.isString(message.parent)) - return "parent: string expected"; - if (message.policyBasedRouteId != null && message.hasOwnProperty("policyBasedRouteId")) - if (!$util.isString(message.policyBasedRouteId)) - return "policyBasedRouteId: string expected"; - if (message.policyBasedRoute != null && message.hasOwnProperty("policyBasedRoute")) { - var error = $root.google.cloud.networkconnectivity.v1.PolicyBasedRoute.verify(message.policyBasedRoute); - if (error) - return "policyBasedRoute." + error; - } - if (message.requestId != null && message.hasOwnProperty("requestId")) - if (!$util.isString(message.requestId)) - return "requestId: string expected"; - return null; - }; - - /** - * Creates a CreatePolicyBasedRouteRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.networkconnectivity.v1.CreatePolicyBasedRouteRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.networkconnectivity.v1.CreatePolicyBasedRouteRequest} CreatePolicyBasedRouteRequest - */ - CreatePolicyBasedRouteRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.networkconnectivity.v1.CreatePolicyBasedRouteRequest) - return object; - var message = new $root.google.cloud.networkconnectivity.v1.CreatePolicyBasedRouteRequest(); - if (object.parent != null) - message.parent = String(object.parent); - if (object.policyBasedRouteId != null) - message.policyBasedRouteId = String(object.policyBasedRouteId); - if (object.policyBasedRoute != null) { - if (typeof object.policyBasedRoute !== "object") - throw TypeError(".google.cloud.networkconnectivity.v1.CreatePolicyBasedRouteRequest.policyBasedRoute: object expected"); - message.policyBasedRoute = $root.google.cloud.networkconnectivity.v1.PolicyBasedRoute.fromObject(object.policyBasedRoute); - } - if (object.requestId != null) - message.requestId = String(object.requestId); - return message; - }; - - /** - * Creates a plain object from a CreatePolicyBasedRouteRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.networkconnectivity.v1.CreatePolicyBasedRouteRequest - * @static - * @param {google.cloud.networkconnectivity.v1.CreatePolicyBasedRouteRequest} message CreatePolicyBasedRouteRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - CreatePolicyBasedRouteRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.parent = ""; - object.policyBasedRouteId = ""; - object.policyBasedRoute = null; - object.requestId = ""; - } - if (message.parent != null && message.hasOwnProperty("parent")) - object.parent = message.parent; - if (message.policyBasedRouteId != null && message.hasOwnProperty("policyBasedRouteId")) - object.policyBasedRouteId = message.policyBasedRouteId; - if (message.policyBasedRoute != null && message.hasOwnProperty("policyBasedRoute")) - object.policyBasedRoute = $root.google.cloud.networkconnectivity.v1.PolicyBasedRoute.toObject(message.policyBasedRoute, options); - if (message.requestId != null && message.hasOwnProperty("requestId")) - object.requestId = message.requestId; - return object; - }; - - /** - * Converts this CreatePolicyBasedRouteRequest to JSON. - * @function toJSON - * @memberof google.cloud.networkconnectivity.v1.CreatePolicyBasedRouteRequest - * @instance - * @returns {Object.} JSON object - */ - CreatePolicyBasedRouteRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for CreatePolicyBasedRouteRequest - * @function getTypeUrl - * @memberof google.cloud.networkconnectivity.v1.CreatePolicyBasedRouteRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - CreatePolicyBasedRouteRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.networkconnectivity.v1.CreatePolicyBasedRouteRequest"; - }; - - return CreatePolicyBasedRouteRequest; - })(); - - v1.DeletePolicyBasedRouteRequest = (function() { - - /** - * Properties of a DeletePolicyBasedRouteRequest. - * @memberof google.cloud.networkconnectivity.v1 - * @interface IDeletePolicyBasedRouteRequest - * @property {string|null} [name] DeletePolicyBasedRouteRequest name - * @property {string|null} [requestId] DeletePolicyBasedRouteRequest requestId - */ - - /** - * Constructs a new DeletePolicyBasedRouteRequest. - * @memberof google.cloud.networkconnectivity.v1 - * @classdesc Represents a DeletePolicyBasedRouteRequest. - * @implements IDeletePolicyBasedRouteRequest - * @constructor - * @param {google.cloud.networkconnectivity.v1.IDeletePolicyBasedRouteRequest=} [properties] Properties to set - */ - function DeletePolicyBasedRouteRequest(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * DeletePolicyBasedRouteRequest name. - * @member {string} name - * @memberof google.cloud.networkconnectivity.v1.DeletePolicyBasedRouteRequest - * @instance - */ - DeletePolicyBasedRouteRequest.prototype.name = ""; - - /** - * DeletePolicyBasedRouteRequest requestId. - * @member {string} requestId - * @memberof google.cloud.networkconnectivity.v1.DeletePolicyBasedRouteRequest - * @instance - */ - DeletePolicyBasedRouteRequest.prototype.requestId = ""; - - /** - * Creates a new DeletePolicyBasedRouteRequest instance using the specified properties. - * @function create - * @memberof google.cloud.networkconnectivity.v1.DeletePolicyBasedRouteRequest - * @static - * @param {google.cloud.networkconnectivity.v1.IDeletePolicyBasedRouteRequest=} [properties] Properties to set - * @returns {google.cloud.networkconnectivity.v1.DeletePolicyBasedRouteRequest} DeletePolicyBasedRouteRequest instance - */ - DeletePolicyBasedRouteRequest.create = function create(properties) { - return new DeletePolicyBasedRouteRequest(properties); - }; - - /** - * Encodes the specified DeletePolicyBasedRouteRequest message. Does not implicitly {@link google.cloud.networkconnectivity.v1.DeletePolicyBasedRouteRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.networkconnectivity.v1.DeletePolicyBasedRouteRequest - * @static - * @param {google.cloud.networkconnectivity.v1.IDeletePolicyBasedRouteRequest} message DeletePolicyBasedRouteRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - DeletePolicyBasedRouteRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.name != null && Object.hasOwnProperty.call(message, "name")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); - if (message.requestId != null && Object.hasOwnProperty.call(message, "requestId")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.requestId); - return writer; - }; - - /** - * Encodes the specified DeletePolicyBasedRouteRequest message, length delimited. Does not implicitly {@link google.cloud.networkconnectivity.v1.DeletePolicyBasedRouteRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.networkconnectivity.v1.DeletePolicyBasedRouteRequest - * @static - * @param {google.cloud.networkconnectivity.v1.IDeletePolicyBasedRouteRequest} message DeletePolicyBasedRouteRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - DeletePolicyBasedRouteRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a DeletePolicyBasedRouteRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.networkconnectivity.v1.DeletePolicyBasedRouteRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.networkconnectivity.v1.DeletePolicyBasedRouteRequest} DeletePolicyBasedRouteRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - DeletePolicyBasedRouteRequest.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.networkconnectivity.v1.DeletePolicyBasedRouteRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.name = reader.string(); - break; - } - case 2: { - message.requestId = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a DeletePolicyBasedRouteRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.networkconnectivity.v1.DeletePolicyBasedRouteRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.networkconnectivity.v1.DeletePolicyBasedRouteRequest} DeletePolicyBasedRouteRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - DeletePolicyBasedRouteRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a DeletePolicyBasedRouteRequest message. - * @function verify - * @memberof google.cloud.networkconnectivity.v1.DeletePolicyBasedRouteRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - DeletePolicyBasedRouteRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.name != null && message.hasOwnProperty("name")) - if (!$util.isString(message.name)) - return "name: string expected"; - if (message.requestId != null && message.hasOwnProperty("requestId")) - if (!$util.isString(message.requestId)) - return "requestId: string expected"; - return null; - }; - - /** - * Creates a DeletePolicyBasedRouteRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.networkconnectivity.v1.DeletePolicyBasedRouteRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.networkconnectivity.v1.DeletePolicyBasedRouteRequest} DeletePolicyBasedRouteRequest - */ - DeletePolicyBasedRouteRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.networkconnectivity.v1.DeletePolicyBasedRouteRequest) - return object; - var message = new $root.google.cloud.networkconnectivity.v1.DeletePolicyBasedRouteRequest(); - if (object.name != null) - message.name = String(object.name); - if (object.requestId != null) - message.requestId = String(object.requestId); - return message; - }; - - /** - * Creates a plain object from a DeletePolicyBasedRouteRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.networkconnectivity.v1.DeletePolicyBasedRouteRequest - * @static - * @param {google.cloud.networkconnectivity.v1.DeletePolicyBasedRouteRequest} message DeletePolicyBasedRouteRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - DeletePolicyBasedRouteRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.name = ""; - object.requestId = ""; - } - if (message.name != null && message.hasOwnProperty("name")) - object.name = message.name; - if (message.requestId != null && message.hasOwnProperty("requestId")) - object.requestId = message.requestId; - return object; - }; - - /** - * Converts this DeletePolicyBasedRouteRequest to JSON. - * @function toJSON - * @memberof google.cloud.networkconnectivity.v1.DeletePolicyBasedRouteRequest - * @instance - * @returns {Object.} JSON object - */ - DeletePolicyBasedRouteRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for DeletePolicyBasedRouteRequest - * @function getTypeUrl - * @memberof google.cloud.networkconnectivity.v1.DeletePolicyBasedRouteRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - DeletePolicyBasedRouteRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.networkconnectivity.v1.DeletePolicyBasedRouteRequest"; - }; - - return DeletePolicyBasedRouteRequest; - })(); - - return v1; - })(); - - networkconnectivity.v1alpha1 = (function() { - - /** - * Namespace v1alpha1. - * @memberof google.cloud.networkconnectivity - * @namespace - */ - var v1alpha1 = {}; - - v1alpha1.OperationMetadata = (function() { - - /** - * Properties of an OperationMetadata. - * @memberof google.cloud.networkconnectivity.v1alpha1 - * @interface IOperationMetadata - * @property {google.protobuf.ITimestamp|null} [createTime] OperationMetadata createTime - * @property {google.protobuf.ITimestamp|null} [endTime] OperationMetadata endTime - * @property {string|null} [target] OperationMetadata target - * @property {string|null} [verb] OperationMetadata verb - * @property {string|null} [statusMessage] OperationMetadata statusMessage - * @property {boolean|null} [requestedCancellation] OperationMetadata requestedCancellation - * @property {string|null} [apiVersion] OperationMetadata apiVersion - */ - - /** - * Constructs a new OperationMetadata. - * @memberof google.cloud.networkconnectivity.v1alpha1 - * @classdesc Represents an OperationMetadata. - * @implements IOperationMetadata - * @constructor - * @param {google.cloud.networkconnectivity.v1alpha1.IOperationMetadata=} [properties] Properties to set - */ - function OperationMetadata(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * OperationMetadata createTime. - * @member {google.protobuf.ITimestamp|null|undefined} createTime - * @memberof google.cloud.networkconnectivity.v1alpha1.OperationMetadata - * @instance - */ - OperationMetadata.prototype.createTime = null; - - /** - * OperationMetadata endTime. - * @member {google.protobuf.ITimestamp|null|undefined} endTime - * @memberof google.cloud.networkconnectivity.v1alpha1.OperationMetadata - * @instance - */ - OperationMetadata.prototype.endTime = null; - - /** - * OperationMetadata target. - * @member {string} target - * @memberof google.cloud.networkconnectivity.v1alpha1.OperationMetadata - * @instance - */ - OperationMetadata.prototype.target = ""; - - /** - * OperationMetadata verb. - * @member {string} verb - * @memberof google.cloud.networkconnectivity.v1alpha1.OperationMetadata - * @instance - */ - OperationMetadata.prototype.verb = ""; - - /** - * OperationMetadata statusMessage. - * @member {string} statusMessage - * @memberof google.cloud.networkconnectivity.v1alpha1.OperationMetadata - * @instance - */ - OperationMetadata.prototype.statusMessage = ""; - - /** - * OperationMetadata requestedCancellation. - * @member {boolean} requestedCancellation - * @memberof google.cloud.networkconnectivity.v1alpha1.OperationMetadata - * @instance - */ - OperationMetadata.prototype.requestedCancellation = false; - - /** - * OperationMetadata apiVersion. - * @member {string} apiVersion - * @memberof google.cloud.networkconnectivity.v1alpha1.OperationMetadata - * @instance - */ - OperationMetadata.prototype.apiVersion = ""; - - /** - * Creates a new OperationMetadata instance using the specified properties. - * @function create - * @memberof google.cloud.networkconnectivity.v1alpha1.OperationMetadata - * @static - * @param {google.cloud.networkconnectivity.v1alpha1.IOperationMetadata=} [properties] Properties to set - * @returns {google.cloud.networkconnectivity.v1alpha1.OperationMetadata} OperationMetadata instance - */ - OperationMetadata.create = function create(properties) { - return new OperationMetadata(properties); - }; - - /** - * Encodes the specified OperationMetadata message. Does not implicitly {@link google.cloud.networkconnectivity.v1alpha1.OperationMetadata.verify|verify} messages. - * @function encode - * @memberof google.cloud.networkconnectivity.v1alpha1.OperationMetadata - * @static - * @param {google.cloud.networkconnectivity.v1alpha1.IOperationMetadata} message OperationMetadata message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - OperationMetadata.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.createTime != null && Object.hasOwnProperty.call(message, "createTime")) - $root.google.protobuf.Timestamp.encode(message.createTime, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.endTime != null && Object.hasOwnProperty.call(message, "endTime")) - $root.google.protobuf.Timestamp.encode(message.endTime, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.target != null && Object.hasOwnProperty.call(message, "target")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.target); - if (message.verb != null && Object.hasOwnProperty.call(message, "verb")) - writer.uint32(/* id 4, wireType 2 =*/34).string(message.verb); - if (message.statusMessage != null && Object.hasOwnProperty.call(message, "statusMessage")) - writer.uint32(/* id 5, wireType 2 =*/42).string(message.statusMessage); - if (message.requestedCancellation != null && Object.hasOwnProperty.call(message, "requestedCancellation")) - writer.uint32(/* id 6, wireType 0 =*/48).bool(message.requestedCancellation); - if (message.apiVersion != null && Object.hasOwnProperty.call(message, "apiVersion")) - writer.uint32(/* id 7, wireType 2 =*/58).string(message.apiVersion); - return writer; - }; - - /** - * Encodes the specified OperationMetadata message, length delimited. Does not implicitly {@link google.cloud.networkconnectivity.v1alpha1.OperationMetadata.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.networkconnectivity.v1alpha1.OperationMetadata - * @static - * @param {google.cloud.networkconnectivity.v1alpha1.IOperationMetadata} message OperationMetadata message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - OperationMetadata.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an OperationMetadata message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.networkconnectivity.v1alpha1.OperationMetadata - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.networkconnectivity.v1alpha1.OperationMetadata} OperationMetadata - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - OperationMetadata.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.networkconnectivity.v1alpha1.OperationMetadata(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.createTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); - break; - } - case 2: { - message.endTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); - break; - } - case 3: { - message.target = reader.string(); - break; - } - case 4: { - message.verb = reader.string(); - break; - } - case 5: { - message.statusMessage = reader.string(); - break; - } - case 6: { - message.requestedCancellation = reader.bool(); - break; - } - case 7: { - message.apiVersion = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes an OperationMetadata message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.networkconnectivity.v1alpha1.OperationMetadata - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.networkconnectivity.v1alpha1.OperationMetadata} OperationMetadata - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - OperationMetadata.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an OperationMetadata message. - * @function verify - * @memberof google.cloud.networkconnectivity.v1alpha1.OperationMetadata - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - OperationMetadata.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.createTime != null && message.hasOwnProperty("createTime")) { - var error = $root.google.protobuf.Timestamp.verify(message.createTime); - if (error) - return "createTime." + error; - } - if (message.endTime != null && message.hasOwnProperty("endTime")) { - var error = $root.google.protobuf.Timestamp.verify(message.endTime); - if (error) - return "endTime." + error; - } - if (message.target != null && message.hasOwnProperty("target")) - if (!$util.isString(message.target)) - return "target: string expected"; - if (message.verb != null && message.hasOwnProperty("verb")) - if (!$util.isString(message.verb)) - return "verb: string expected"; - if (message.statusMessage != null && message.hasOwnProperty("statusMessage")) - if (!$util.isString(message.statusMessage)) - return "statusMessage: string expected"; - if (message.requestedCancellation != null && message.hasOwnProperty("requestedCancellation")) - if (typeof message.requestedCancellation !== "boolean") - return "requestedCancellation: boolean expected"; - if (message.apiVersion != null && message.hasOwnProperty("apiVersion")) - if (!$util.isString(message.apiVersion)) - return "apiVersion: string expected"; - return null; - }; - - /** - * Creates an OperationMetadata message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.networkconnectivity.v1alpha1.OperationMetadata - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.networkconnectivity.v1alpha1.OperationMetadata} OperationMetadata - */ - OperationMetadata.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.networkconnectivity.v1alpha1.OperationMetadata) - return object; - var message = new $root.google.cloud.networkconnectivity.v1alpha1.OperationMetadata(); - if (object.createTime != null) { - if (typeof object.createTime !== "object") - throw TypeError(".google.cloud.networkconnectivity.v1alpha1.OperationMetadata.createTime: object expected"); - message.createTime = $root.google.protobuf.Timestamp.fromObject(object.createTime); - } - if (object.endTime != null) { - if (typeof object.endTime !== "object") - throw TypeError(".google.cloud.networkconnectivity.v1alpha1.OperationMetadata.endTime: object expected"); - message.endTime = $root.google.protobuf.Timestamp.fromObject(object.endTime); - } - if (object.target != null) - message.target = String(object.target); - if (object.verb != null) - message.verb = String(object.verb); - if (object.statusMessage != null) - message.statusMessage = String(object.statusMessage); - if (object.requestedCancellation != null) - message.requestedCancellation = Boolean(object.requestedCancellation); - if (object.apiVersion != null) - message.apiVersion = String(object.apiVersion); - return message; - }; - - /** - * Creates a plain object from an OperationMetadata message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.networkconnectivity.v1alpha1.OperationMetadata - * @static - * @param {google.cloud.networkconnectivity.v1alpha1.OperationMetadata} message OperationMetadata - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - OperationMetadata.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.createTime = null; - object.endTime = null; - object.target = ""; - object.verb = ""; - object.statusMessage = ""; - object.requestedCancellation = false; - object.apiVersion = ""; - } - if (message.createTime != null && message.hasOwnProperty("createTime")) - object.createTime = $root.google.protobuf.Timestamp.toObject(message.createTime, options); - if (message.endTime != null && message.hasOwnProperty("endTime")) - object.endTime = $root.google.protobuf.Timestamp.toObject(message.endTime, options); - if (message.target != null && message.hasOwnProperty("target")) - object.target = message.target; - if (message.verb != null && message.hasOwnProperty("verb")) - object.verb = message.verb; - if (message.statusMessage != null && message.hasOwnProperty("statusMessage")) - object.statusMessage = message.statusMessage; - if (message.requestedCancellation != null && message.hasOwnProperty("requestedCancellation")) - object.requestedCancellation = message.requestedCancellation; - if (message.apiVersion != null && message.hasOwnProperty("apiVersion")) - object.apiVersion = message.apiVersion; - return object; - }; - - /** - * Converts this OperationMetadata to JSON. - * @function toJSON - * @memberof google.cloud.networkconnectivity.v1alpha1.OperationMetadata - * @instance - * @returns {Object.} JSON object - */ - OperationMetadata.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for OperationMetadata + * Gets the default type url for OperationMetadata * @function getTypeUrl * @memberof google.cloud.networkconnectivity.v1alpha1.OperationMetadata * @static @@ -14737,32 +11512,26 @@ return values; })(); - api.ResourceDescriptor = (function() { + api.Http = (function() { /** - * Properties of a ResourceDescriptor. + * Properties of a Http. * @memberof google.api - * @interface IResourceDescriptor - * @property {string|null} [type] ResourceDescriptor type - * @property {Array.|null} [pattern] ResourceDescriptor pattern - * @property {string|null} [nameField] ResourceDescriptor nameField - * @property {google.api.ResourceDescriptor.History|null} [history] ResourceDescriptor history - * @property {string|null} [plural] ResourceDescriptor plural - * @property {string|null} [singular] ResourceDescriptor singular - * @property {Array.|null} [style] ResourceDescriptor style + * @interface IHttp + * @property {Array.|null} [rules] Http rules + * @property {boolean|null} [fullyDecodeReservedExpansion] Http fullyDecodeReservedExpansion */ /** - * Constructs a new ResourceDescriptor. + * Constructs a new Http. * @memberof google.api - * @classdesc Represents a ResourceDescriptor. - * @implements IResourceDescriptor + * @classdesc Represents a Http. + * @implements IHttp * @constructor - * @param {google.api.IResourceDescriptor=} [properties] Properties to set + * @param {google.api.IHttp=} [properties] Properties to set */ - function ResourceDescriptor(properties) { - this.pattern = []; - this.style = []; + function Http(properties) { + this.rules = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -14770,173 +11539,92 @@ } /** - * ResourceDescriptor type. - * @member {string} type - * @memberof google.api.ResourceDescriptor - * @instance - */ - ResourceDescriptor.prototype.type = ""; - - /** - * ResourceDescriptor pattern. - * @member {Array.} pattern - * @memberof google.api.ResourceDescriptor - * @instance - */ - ResourceDescriptor.prototype.pattern = $util.emptyArray; - - /** - * ResourceDescriptor nameField. - * @member {string} nameField - * @memberof google.api.ResourceDescriptor - * @instance - */ - ResourceDescriptor.prototype.nameField = ""; - - /** - * ResourceDescriptor history. - * @member {google.api.ResourceDescriptor.History} history - * @memberof google.api.ResourceDescriptor - * @instance - */ - ResourceDescriptor.prototype.history = 0; - - /** - * ResourceDescriptor plural. - * @member {string} plural - * @memberof google.api.ResourceDescriptor - * @instance - */ - ResourceDescriptor.prototype.plural = ""; - - /** - * ResourceDescriptor singular. - * @member {string} singular - * @memberof google.api.ResourceDescriptor + * Http rules. + * @member {Array.} rules + * @memberof google.api.Http * @instance */ - ResourceDescriptor.prototype.singular = ""; + Http.prototype.rules = $util.emptyArray; /** - * ResourceDescriptor style. - * @member {Array.} style - * @memberof google.api.ResourceDescriptor + * Http fullyDecodeReservedExpansion. + * @member {boolean} fullyDecodeReservedExpansion + * @memberof google.api.Http * @instance */ - ResourceDescriptor.prototype.style = $util.emptyArray; + Http.prototype.fullyDecodeReservedExpansion = false; /** - * Creates a new ResourceDescriptor instance using the specified properties. + * Creates a new Http instance using the specified properties. * @function create - * @memberof google.api.ResourceDescriptor + * @memberof google.api.Http * @static - * @param {google.api.IResourceDescriptor=} [properties] Properties to set - * @returns {google.api.ResourceDescriptor} ResourceDescriptor instance + * @param {google.api.IHttp=} [properties] Properties to set + * @returns {google.api.Http} Http instance */ - ResourceDescriptor.create = function create(properties) { - return new ResourceDescriptor(properties); + Http.create = function create(properties) { + return new Http(properties); }; /** - * Encodes the specified ResourceDescriptor message. Does not implicitly {@link google.api.ResourceDescriptor.verify|verify} messages. + * Encodes the specified Http message. Does not implicitly {@link google.api.Http.verify|verify} messages. * @function encode - * @memberof google.api.ResourceDescriptor + * @memberof google.api.Http * @static - * @param {google.api.IResourceDescriptor} message ResourceDescriptor message or plain object to encode + * @param {google.api.IHttp} message Http message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ResourceDescriptor.encode = function encode(message, writer) { + Http.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.type != null && Object.hasOwnProperty.call(message, "type")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.type); - if (message.pattern != null && message.pattern.length) - for (var i = 0; i < message.pattern.length; ++i) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.pattern[i]); - if (message.nameField != null && Object.hasOwnProperty.call(message, "nameField")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.nameField); - if (message.history != null && Object.hasOwnProperty.call(message, "history")) - writer.uint32(/* id 4, wireType 0 =*/32).int32(message.history); - if (message.plural != null && Object.hasOwnProperty.call(message, "plural")) - writer.uint32(/* id 5, wireType 2 =*/42).string(message.plural); - if (message.singular != null && Object.hasOwnProperty.call(message, "singular")) - writer.uint32(/* id 6, wireType 2 =*/50).string(message.singular); - if (message.style != null && message.style.length) { - writer.uint32(/* id 10, wireType 2 =*/82).fork(); - for (var i = 0; i < message.style.length; ++i) - writer.int32(message.style[i]); - writer.ldelim(); - } + if (message.rules != null && message.rules.length) + for (var i = 0; i < message.rules.length; ++i) + $root.google.api.HttpRule.encode(message.rules[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.fullyDecodeReservedExpansion != null && Object.hasOwnProperty.call(message, "fullyDecodeReservedExpansion")) + writer.uint32(/* id 2, wireType 0 =*/16).bool(message.fullyDecodeReservedExpansion); return writer; }; /** - * Encodes the specified ResourceDescriptor message, length delimited. Does not implicitly {@link google.api.ResourceDescriptor.verify|verify} messages. + * Encodes the specified Http message, length delimited. Does not implicitly {@link google.api.Http.verify|verify} messages. * @function encodeDelimited - * @memberof google.api.ResourceDescriptor + * @memberof google.api.Http * @static - * @param {google.api.IResourceDescriptor} message ResourceDescriptor message or plain object to encode + * @param {google.api.IHttp} message Http message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ResourceDescriptor.encodeDelimited = function encodeDelimited(message, writer) { + Http.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a ResourceDescriptor message from the specified reader or buffer. + * Decodes a Http message from the specified reader or buffer. * @function decode - * @memberof google.api.ResourceDescriptor + * @memberof google.api.Http * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.api.ResourceDescriptor} ResourceDescriptor + * @returns {google.api.Http} Http * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ResourceDescriptor.decode = function decode(reader, length) { + Http.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.ResourceDescriptor(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.Http(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: { - message.type = reader.string(); + if (!(message.rules && message.rules.length)) + message.rules = []; + message.rules.push($root.google.api.HttpRule.decode(reader, reader.uint32())); break; } case 2: { - if (!(message.pattern && message.pattern.length)) - message.pattern = []; - message.pattern.push(reader.string()); - break; - } - case 3: { - message.nameField = reader.string(); - break; - } - case 4: { - message.history = reader.int32(); - break; - } - case 5: { - message.plural = reader.string(); - break; - } - case 6: { - message.singular = reader.string(); - break; - } - case 10: { - if (!(message.style && message.style.length)) - message.style = []; - if ((tag & 7) === 2) { - var end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) - message.style.push(reader.int32()); - } else - message.style.push(reader.int32()); + message.fullyDecodeReservedExpansion = reader.bool(); break; } default: @@ -14948,361 +11636,377 @@ }; /** - * Decodes a ResourceDescriptor message from the specified reader or buffer, length delimited. + * Decodes a Http message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.api.ResourceDescriptor + * @memberof google.api.Http * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.api.ResourceDescriptor} ResourceDescriptor + * @returns {google.api.Http} Http * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ResourceDescriptor.decodeDelimited = function decodeDelimited(reader) { + Http.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a ResourceDescriptor message. + * Verifies a Http message. * @function verify - * @memberof google.api.ResourceDescriptor + * @memberof google.api.Http * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - ResourceDescriptor.verify = function verify(message) { + Http.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.type != null && message.hasOwnProperty("type")) - if (!$util.isString(message.type)) - return "type: string expected"; - if (message.pattern != null && message.hasOwnProperty("pattern")) { - if (!Array.isArray(message.pattern)) - return "pattern: array expected"; - for (var i = 0; i < message.pattern.length; ++i) - if (!$util.isString(message.pattern[i])) - return "pattern: string[] expected"; - } - if (message.nameField != null && message.hasOwnProperty("nameField")) - if (!$util.isString(message.nameField)) - return "nameField: string expected"; - if (message.history != null && message.hasOwnProperty("history")) - switch (message.history) { - default: - return "history: enum value expected"; - case 0: - case 1: - case 2: - break; - } - if (message.plural != null && message.hasOwnProperty("plural")) - if (!$util.isString(message.plural)) - return "plural: string expected"; - if (message.singular != null && message.hasOwnProperty("singular")) - if (!$util.isString(message.singular)) - return "singular: string expected"; - if (message.style != null && message.hasOwnProperty("style")) { - if (!Array.isArray(message.style)) - return "style: array expected"; - for (var i = 0; i < message.style.length; ++i) - switch (message.style[i]) { - default: - return "style: enum value[] expected"; - case 0: - case 1: - break; - } - } - return null; - }; - - /** - * Creates a ResourceDescriptor message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.api.ResourceDescriptor - * @static - * @param {Object.} object Plain object - * @returns {google.api.ResourceDescriptor} ResourceDescriptor - */ - ResourceDescriptor.fromObject = function fromObject(object) { - if (object instanceof $root.google.api.ResourceDescriptor) - return object; - var message = new $root.google.api.ResourceDescriptor(); - if (object.type != null) - message.type = String(object.type); - if (object.pattern) { - if (!Array.isArray(object.pattern)) - throw TypeError(".google.api.ResourceDescriptor.pattern: array expected"); - message.pattern = []; - for (var i = 0; i < object.pattern.length; ++i) - message.pattern[i] = String(object.pattern[i]); - } - if (object.nameField != null) - message.nameField = String(object.nameField); - switch (object.history) { - default: - if (typeof object.history === "number") { - message.history = object.history; - break; + if (message.rules != null && message.hasOwnProperty("rules")) { + if (!Array.isArray(message.rules)) + return "rules: array expected"; + for (var i = 0; i < message.rules.length; ++i) { + var error = $root.google.api.HttpRule.verify(message.rules[i]); + if (error) + return "rules." + error; } - break; - case "HISTORY_UNSPECIFIED": - case 0: - message.history = 0; - break; - case "ORIGINALLY_SINGLE_PATTERN": - case 1: - message.history = 1; - break; - case "FUTURE_MULTI_PATTERN": - case 2: - message.history = 2; - break; } - if (object.plural != null) - message.plural = String(object.plural); - if (object.singular != null) - message.singular = String(object.singular); - if (object.style) { - if (!Array.isArray(object.style)) - throw TypeError(".google.api.ResourceDescriptor.style: array expected"); - message.style = []; - for (var i = 0; i < object.style.length; ++i) - switch (object.style[i]) { - default: - if (typeof object.style[i] === "number") { - message.style[i] = object.style[i]; - break; - } - case "STYLE_UNSPECIFIED": - case 0: - message.style[i] = 0; - break; - case "DECLARATIVE_FRIENDLY": - case 1: - message.style[i] = 1; - break; - } + if (message.fullyDecodeReservedExpansion != null && message.hasOwnProperty("fullyDecodeReservedExpansion")) + if (typeof message.fullyDecodeReservedExpansion !== "boolean") + return "fullyDecodeReservedExpansion: boolean expected"; + return null; + }; + + /** + * Creates a Http message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.api.Http + * @static + * @param {Object.} object Plain object + * @returns {google.api.Http} Http + */ + Http.fromObject = function fromObject(object) { + if (object instanceof $root.google.api.Http) + return object; + var message = new $root.google.api.Http(); + if (object.rules) { + if (!Array.isArray(object.rules)) + throw TypeError(".google.api.Http.rules: array expected"); + message.rules = []; + for (var i = 0; i < object.rules.length; ++i) { + if (typeof object.rules[i] !== "object") + throw TypeError(".google.api.Http.rules: object expected"); + message.rules[i] = $root.google.api.HttpRule.fromObject(object.rules[i]); + } } + if (object.fullyDecodeReservedExpansion != null) + message.fullyDecodeReservedExpansion = Boolean(object.fullyDecodeReservedExpansion); return message; }; /** - * Creates a plain object from a ResourceDescriptor message. Also converts values to other types if specified. + * Creates a plain object from a Http message. Also converts values to other types if specified. * @function toObject - * @memberof google.api.ResourceDescriptor + * @memberof google.api.Http * @static - * @param {google.api.ResourceDescriptor} message ResourceDescriptor + * @param {google.api.Http} message Http * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - ResourceDescriptor.toObject = function toObject(message, options) { + Http.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.arrays || options.defaults) { - object.pattern = []; - object.style = []; - } - if (options.defaults) { - object.type = ""; - object.nameField = ""; - object.history = options.enums === String ? "HISTORY_UNSPECIFIED" : 0; - object.plural = ""; - object.singular = ""; - } - if (message.type != null && message.hasOwnProperty("type")) - object.type = message.type; - if (message.pattern && message.pattern.length) { - object.pattern = []; - for (var j = 0; j < message.pattern.length; ++j) - object.pattern[j] = message.pattern[j]; - } - if (message.nameField != null && message.hasOwnProperty("nameField")) - object.nameField = message.nameField; - if (message.history != null && message.hasOwnProperty("history")) - object.history = options.enums === String ? $root.google.api.ResourceDescriptor.History[message.history] === undefined ? message.history : $root.google.api.ResourceDescriptor.History[message.history] : message.history; - if (message.plural != null && message.hasOwnProperty("plural")) - object.plural = message.plural; - if (message.singular != null && message.hasOwnProperty("singular")) - object.singular = message.singular; - if (message.style && message.style.length) { - object.style = []; - for (var j = 0; j < message.style.length; ++j) - object.style[j] = options.enums === String ? $root.google.api.ResourceDescriptor.Style[message.style[j]] === undefined ? message.style[j] : $root.google.api.ResourceDescriptor.Style[message.style[j]] : message.style[j]; + if (options.arrays || options.defaults) + object.rules = []; + if (options.defaults) + object.fullyDecodeReservedExpansion = false; + if (message.rules && message.rules.length) { + object.rules = []; + for (var j = 0; j < message.rules.length; ++j) + object.rules[j] = $root.google.api.HttpRule.toObject(message.rules[j], options); } + if (message.fullyDecodeReservedExpansion != null && message.hasOwnProperty("fullyDecodeReservedExpansion")) + object.fullyDecodeReservedExpansion = message.fullyDecodeReservedExpansion; return object; }; /** - * Converts this ResourceDescriptor to JSON. + * Converts this Http to JSON. * @function toJSON - * @memberof google.api.ResourceDescriptor + * @memberof google.api.Http * @instance * @returns {Object.} JSON object */ - ResourceDescriptor.prototype.toJSON = function toJSON() { + Http.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; /** - * Gets the default type url for ResourceDescriptor + * Gets the default type url for Http * @function getTypeUrl - * @memberof google.api.ResourceDescriptor + * @memberof google.api.Http * @static * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns {string} The default type url */ - ResourceDescriptor.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + Http.getTypeUrl = function getTypeUrl(typeUrlPrefix) { if (typeUrlPrefix === undefined) { typeUrlPrefix = "type.googleapis.com"; } - return typeUrlPrefix + "/google.api.ResourceDescriptor"; + return typeUrlPrefix + "/google.api.Http"; }; + return Http; + })(); + + api.HttpRule = (function() { + /** - * History enum. - * @name google.api.ResourceDescriptor.History - * @enum {number} - * @property {number} HISTORY_UNSPECIFIED=0 HISTORY_UNSPECIFIED value - * @property {number} ORIGINALLY_SINGLE_PATTERN=1 ORIGINALLY_SINGLE_PATTERN value - * @property {number} FUTURE_MULTI_PATTERN=2 FUTURE_MULTI_PATTERN value + * Properties of a HttpRule. + * @memberof google.api + * @interface IHttpRule + * @property {string|null} [selector] HttpRule selector + * @property {string|null} [get] HttpRule get + * @property {string|null} [put] HttpRule put + * @property {string|null} [post] HttpRule post + * @property {string|null} ["delete"] HttpRule delete + * @property {string|null} [patch] HttpRule patch + * @property {google.api.ICustomHttpPattern|null} [custom] HttpRule custom + * @property {string|null} [body] HttpRule body + * @property {string|null} [responseBody] HttpRule responseBody + * @property {Array.|null} [additionalBindings] HttpRule additionalBindings */ - ResourceDescriptor.History = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "HISTORY_UNSPECIFIED"] = 0; - values[valuesById[1] = "ORIGINALLY_SINGLE_PATTERN"] = 1; - values[valuesById[2] = "FUTURE_MULTI_PATTERN"] = 2; - return values; - })(); /** - * Style enum. - * @name google.api.ResourceDescriptor.Style - * @enum {number} - * @property {number} STYLE_UNSPECIFIED=0 STYLE_UNSPECIFIED value - * @property {number} DECLARATIVE_FRIENDLY=1 DECLARATIVE_FRIENDLY value + * Constructs a new HttpRule. + * @memberof google.api + * @classdesc Represents a HttpRule. + * @implements IHttpRule + * @constructor + * @param {google.api.IHttpRule=} [properties] Properties to set */ - ResourceDescriptor.Style = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "STYLE_UNSPECIFIED"] = 0; - values[valuesById[1] = "DECLARATIVE_FRIENDLY"] = 1; - return values; - })(); + function HttpRule(properties) { + this.additionalBindings = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } - return ResourceDescriptor; - })(); + /** + * HttpRule selector. + * @member {string} selector + * @memberof google.api.HttpRule + * @instance + */ + HttpRule.prototype.selector = ""; - api.ResourceReference = (function() { + /** + * HttpRule get. + * @member {string|null|undefined} get + * @memberof google.api.HttpRule + * @instance + */ + HttpRule.prototype.get = null; /** - * Properties of a ResourceReference. - * @memberof google.api - * @interface IResourceReference - * @property {string|null} [type] ResourceReference type - * @property {string|null} [childType] ResourceReference childType + * HttpRule put. + * @member {string|null|undefined} put + * @memberof google.api.HttpRule + * @instance */ + HttpRule.prototype.put = null; /** - * Constructs a new ResourceReference. - * @memberof google.api - * @classdesc Represents a ResourceReference. - * @implements IResourceReference - * @constructor - * @param {google.api.IResourceReference=} [properties] Properties to set + * HttpRule post. + * @member {string|null|undefined} post + * @memberof google.api.HttpRule + * @instance + */ + HttpRule.prototype.post = null; + + /** + * HttpRule delete. + * @member {string|null|undefined} delete + * @memberof google.api.HttpRule + * @instance + */ + HttpRule.prototype["delete"] = null; + + /** + * HttpRule patch. + * @member {string|null|undefined} patch + * @memberof google.api.HttpRule + * @instance + */ + HttpRule.prototype.patch = null; + + /** + * HttpRule custom. + * @member {google.api.ICustomHttpPattern|null|undefined} custom + * @memberof google.api.HttpRule + * @instance + */ + HttpRule.prototype.custom = null; + + /** + * HttpRule body. + * @member {string} body + * @memberof google.api.HttpRule + * @instance + */ + HttpRule.prototype.body = ""; + + /** + * HttpRule responseBody. + * @member {string} responseBody + * @memberof google.api.HttpRule + * @instance */ - function ResourceReference(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } + HttpRule.prototype.responseBody = ""; /** - * ResourceReference type. - * @member {string} type - * @memberof google.api.ResourceReference + * HttpRule additionalBindings. + * @member {Array.} additionalBindings + * @memberof google.api.HttpRule * @instance */ - ResourceReference.prototype.type = ""; + HttpRule.prototype.additionalBindings = $util.emptyArray; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; /** - * ResourceReference childType. - * @member {string} childType - * @memberof google.api.ResourceReference + * HttpRule pattern. + * @member {"get"|"put"|"post"|"delete"|"patch"|"custom"|undefined} pattern + * @memberof google.api.HttpRule * @instance */ - ResourceReference.prototype.childType = ""; + Object.defineProperty(HttpRule.prototype, "pattern", { + get: $util.oneOfGetter($oneOfFields = ["get", "put", "post", "delete", "patch", "custom"]), + set: $util.oneOfSetter($oneOfFields) + }); /** - * Creates a new ResourceReference instance using the specified properties. + * Creates a new HttpRule instance using the specified properties. * @function create - * @memberof google.api.ResourceReference + * @memberof google.api.HttpRule * @static - * @param {google.api.IResourceReference=} [properties] Properties to set - * @returns {google.api.ResourceReference} ResourceReference instance + * @param {google.api.IHttpRule=} [properties] Properties to set + * @returns {google.api.HttpRule} HttpRule instance */ - ResourceReference.create = function create(properties) { - return new ResourceReference(properties); + HttpRule.create = function create(properties) { + return new HttpRule(properties); }; /** - * Encodes the specified ResourceReference message. Does not implicitly {@link google.api.ResourceReference.verify|verify} messages. + * Encodes the specified HttpRule message. Does not implicitly {@link google.api.HttpRule.verify|verify} messages. * @function encode - * @memberof google.api.ResourceReference + * @memberof google.api.HttpRule * @static - * @param {google.api.IResourceReference} message ResourceReference message or plain object to encode + * @param {google.api.IHttpRule} message HttpRule message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ResourceReference.encode = function encode(message, writer) { + HttpRule.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.type != null && Object.hasOwnProperty.call(message, "type")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.type); - if (message.childType != null && Object.hasOwnProperty.call(message, "childType")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.childType); + if (message.selector != null && Object.hasOwnProperty.call(message, "selector")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.selector); + if (message.get != null && Object.hasOwnProperty.call(message, "get")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.get); + if (message.put != null && Object.hasOwnProperty.call(message, "put")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.put); + if (message.post != null && Object.hasOwnProperty.call(message, "post")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.post); + if (message["delete"] != null && Object.hasOwnProperty.call(message, "delete")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message["delete"]); + if (message.patch != null && Object.hasOwnProperty.call(message, "patch")) + writer.uint32(/* id 6, wireType 2 =*/50).string(message.patch); + if (message.body != null && Object.hasOwnProperty.call(message, "body")) + writer.uint32(/* id 7, wireType 2 =*/58).string(message.body); + if (message.custom != null && Object.hasOwnProperty.call(message, "custom")) + $root.google.api.CustomHttpPattern.encode(message.custom, writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); + if (message.additionalBindings != null && message.additionalBindings.length) + for (var i = 0; i < message.additionalBindings.length; ++i) + $root.google.api.HttpRule.encode(message.additionalBindings[i], writer.uint32(/* id 11, wireType 2 =*/90).fork()).ldelim(); + if (message.responseBody != null && Object.hasOwnProperty.call(message, "responseBody")) + writer.uint32(/* id 12, wireType 2 =*/98).string(message.responseBody); return writer; }; /** - * Encodes the specified ResourceReference message, length delimited. Does not implicitly {@link google.api.ResourceReference.verify|verify} messages. + * Encodes the specified HttpRule message, length delimited. Does not implicitly {@link google.api.HttpRule.verify|verify} messages. * @function encodeDelimited - * @memberof google.api.ResourceReference + * @memberof google.api.HttpRule * @static - * @param {google.api.IResourceReference} message ResourceReference message or plain object to encode + * @param {google.api.IHttpRule} message HttpRule message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ResourceReference.encodeDelimited = function encodeDelimited(message, writer) { + HttpRule.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a ResourceReference message from the specified reader or buffer. + * Decodes a HttpRule message from the specified reader or buffer. * @function decode - * @memberof google.api.ResourceReference + * @memberof google.api.HttpRule * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.api.ResourceReference} ResourceReference + * @returns {google.api.HttpRule} HttpRule * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ResourceReference.decode = function decode(reader, length) { + HttpRule.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.ResourceReference(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.HttpRule(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: { - message.type = reader.string(); + message.selector = reader.string(); break; } case 2: { - message.childType = reader.string(); + message.get = reader.string(); + break; + } + case 3: { + message.put = reader.string(); + break; + } + case 4: { + message.post = reader.string(); + break; + } + case 5: { + message["delete"] = reader.string(); + break; + } + case 6: { + message.patch = reader.string(); + break; + } + case 8: { + message.custom = $root.google.api.CustomHttpPattern.decode(reader, reader.uint32()); + break; + } + case 7: { + message.body = reader.string(); + break; + } + case 12: { + message.responseBody = reader.string(); + break; + } + case 11: { + if (!(message.additionalBindings && message.additionalBindings.length)) + message.additionalBindings = []; + message.additionalBindings.push($root.google.api.HttpRule.decode(reader, reader.uint32())); break; } default: @@ -15314,133 +12018,255 @@ }; /** - * Decodes a ResourceReference message from the specified reader or buffer, length delimited. + * Decodes a HttpRule message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.api.ResourceReference + * @memberof google.api.HttpRule * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.api.ResourceReference} ResourceReference + * @returns {google.api.HttpRule} HttpRule * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ResourceReference.decodeDelimited = function decodeDelimited(reader) { + HttpRule.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a ResourceReference message. + * Verifies a HttpRule message. * @function verify - * @memberof google.api.ResourceReference + * @memberof google.api.HttpRule * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - ResourceReference.verify = function verify(message) { + HttpRule.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.type != null && message.hasOwnProperty("type")) - if (!$util.isString(message.type)) - return "type: string expected"; - if (message.childType != null && message.hasOwnProperty("childType")) - if (!$util.isString(message.childType)) - return "childType: string expected"; + var properties = {}; + if (message.selector != null && message.hasOwnProperty("selector")) + if (!$util.isString(message.selector)) + return "selector: string expected"; + if (message.get != null && message.hasOwnProperty("get")) { + properties.pattern = 1; + if (!$util.isString(message.get)) + return "get: string expected"; + } + if (message.put != null && message.hasOwnProperty("put")) { + if (properties.pattern === 1) + return "pattern: multiple values"; + properties.pattern = 1; + if (!$util.isString(message.put)) + return "put: string expected"; + } + if (message.post != null && message.hasOwnProperty("post")) { + if (properties.pattern === 1) + return "pattern: multiple values"; + properties.pattern = 1; + if (!$util.isString(message.post)) + return "post: string expected"; + } + if (message["delete"] != null && message.hasOwnProperty("delete")) { + if (properties.pattern === 1) + return "pattern: multiple values"; + properties.pattern = 1; + if (!$util.isString(message["delete"])) + return "delete: string expected"; + } + if (message.patch != null && message.hasOwnProperty("patch")) { + if (properties.pattern === 1) + return "pattern: multiple values"; + properties.pattern = 1; + if (!$util.isString(message.patch)) + return "patch: string expected"; + } + if (message.custom != null && message.hasOwnProperty("custom")) { + if (properties.pattern === 1) + return "pattern: multiple values"; + properties.pattern = 1; + { + var error = $root.google.api.CustomHttpPattern.verify(message.custom); + if (error) + return "custom." + error; + } + } + if (message.body != null && message.hasOwnProperty("body")) + if (!$util.isString(message.body)) + return "body: string expected"; + if (message.responseBody != null && message.hasOwnProperty("responseBody")) + if (!$util.isString(message.responseBody)) + return "responseBody: string expected"; + if (message.additionalBindings != null && message.hasOwnProperty("additionalBindings")) { + if (!Array.isArray(message.additionalBindings)) + return "additionalBindings: array expected"; + for (var i = 0; i < message.additionalBindings.length; ++i) { + var error = $root.google.api.HttpRule.verify(message.additionalBindings[i]); + if (error) + return "additionalBindings." + error; + } + } return null; }; /** - * Creates a ResourceReference message from a plain object. Also converts values to their respective internal types. + * Creates a HttpRule message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.api.ResourceReference + * @memberof google.api.HttpRule * @static * @param {Object.} object Plain object - * @returns {google.api.ResourceReference} ResourceReference + * @returns {google.api.HttpRule} HttpRule */ - ResourceReference.fromObject = function fromObject(object) { - if (object instanceof $root.google.api.ResourceReference) + HttpRule.fromObject = function fromObject(object) { + if (object instanceof $root.google.api.HttpRule) return object; - var message = new $root.google.api.ResourceReference(); - if (object.type != null) - message.type = String(object.type); - if (object.childType != null) - message.childType = String(object.childType); + var message = new $root.google.api.HttpRule(); + if (object.selector != null) + message.selector = String(object.selector); + if (object.get != null) + message.get = String(object.get); + if (object.put != null) + message.put = String(object.put); + if (object.post != null) + message.post = String(object.post); + if (object["delete"] != null) + message["delete"] = String(object["delete"]); + if (object.patch != null) + message.patch = String(object.patch); + if (object.custom != null) { + if (typeof object.custom !== "object") + throw TypeError(".google.api.HttpRule.custom: object expected"); + message.custom = $root.google.api.CustomHttpPattern.fromObject(object.custom); + } + if (object.body != null) + message.body = String(object.body); + if (object.responseBody != null) + message.responseBody = String(object.responseBody); + if (object.additionalBindings) { + if (!Array.isArray(object.additionalBindings)) + throw TypeError(".google.api.HttpRule.additionalBindings: array expected"); + message.additionalBindings = []; + for (var i = 0; i < object.additionalBindings.length; ++i) { + if (typeof object.additionalBindings[i] !== "object") + throw TypeError(".google.api.HttpRule.additionalBindings: object expected"); + message.additionalBindings[i] = $root.google.api.HttpRule.fromObject(object.additionalBindings[i]); + } + } return message; }; /** - * Creates a plain object from a ResourceReference message. Also converts values to other types if specified. + * Creates a plain object from a HttpRule message. Also converts values to other types if specified. * @function toObject - * @memberof google.api.ResourceReference + * @memberof google.api.HttpRule * @static - * @param {google.api.ResourceReference} message ResourceReference + * @param {google.api.HttpRule} message HttpRule * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - ResourceReference.toObject = function toObject(message, options) { + HttpRule.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; + if (options.arrays || options.defaults) + object.additionalBindings = []; if (options.defaults) { - object.type = ""; - object.childType = ""; + object.selector = ""; + object.body = ""; + object.responseBody = ""; } - if (message.type != null && message.hasOwnProperty("type")) - object.type = message.type; - if (message.childType != null && message.hasOwnProperty("childType")) - object.childType = message.childType; + if (message.selector != null && message.hasOwnProperty("selector")) + object.selector = message.selector; + if (message.get != null && message.hasOwnProperty("get")) { + object.get = message.get; + if (options.oneofs) + object.pattern = "get"; + } + if (message.put != null && message.hasOwnProperty("put")) { + object.put = message.put; + if (options.oneofs) + object.pattern = "put"; + } + if (message.post != null && message.hasOwnProperty("post")) { + object.post = message.post; + if (options.oneofs) + object.pattern = "post"; + } + if (message["delete"] != null && message.hasOwnProperty("delete")) { + object["delete"] = message["delete"]; + if (options.oneofs) + object.pattern = "delete"; + } + if (message.patch != null && message.hasOwnProperty("patch")) { + object.patch = message.patch; + if (options.oneofs) + object.pattern = "patch"; + } + if (message.body != null && message.hasOwnProperty("body")) + object.body = message.body; + if (message.custom != null && message.hasOwnProperty("custom")) { + object.custom = $root.google.api.CustomHttpPattern.toObject(message.custom, options); + if (options.oneofs) + object.pattern = "custom"; + } + if (message.additionalBindings && message.additionalBindings.length) { + object.additionalBindings = []; + for (var j = 0; j < message.additionalBindings.length; ++j) + object.additionalBindings[j] = $root.google.api.HttpRule.toObject(message.additionalBindings[j], options); + } + if (message.responseBody != null && message.hasOwnProperty("responseBody")) + object.responseBody = message.responseBody; return object; }; /** - * Converts this ResourceReference to JSON. + * Converts this HttpRule to JSON. * @function toJSON - * @memberof google.api.ResourceReference + * @memberof google.api.HttpRule * @instance * @returns {Object.} JSON object */ - ResourceReference.prototype.toJSON = function toJSON() { + HttpRule.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; /** - * Gets the default type url for ResourceReference + * Gets the default type url for HttpRule * @function getTypeUrl - * @memberof google.api.ResourceReference + * @memberof google.api.HttpRule * @static * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns {string} The default type url */ - ResourceReference.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + HttpRule.getTypeUrl = function getTypeUrl(typeUrlPrefix) { if (typeUrlPrefix === undefined) { typeUrlPrefix = "type.googleapis.com"; } - return typeUrlPrefix + "/google.api.ResourceReference"; + return typeUrlPrefix + "/google.api.HttpRule"; }; - return ResourceReference; + return HttpRule; })(); - api.Http = (function() { + api.CustomHttpPattern = (function() { /** - * Properties of a Http. + * Properties of a CustomHttpPattern. * @memberof google.api - * @interface IHttp - * @property {Array.|null} [rules] Http rules - * @property {boolean|null} [fullyDecodeReservedExpansion] Http fullyDecodeReservedExpansion + * @interface ICustomHttpPattern + * @property {string|null} [kind] CustomHttpPattern kind + * @property {string|null} [path] CustomHttpPattern path */ /** - * Constructs a new Http. + * Constructs a new CustomHttpPattern. * @memberof google.api - * @classdesc Represents a Http. - * @implements IHttp + * @classdesc Represents a CustomHttpPattern. + * @implements ICustomHttpPattern * @constructor - * @param {google.api.IHttp=} [properties] Properties to set + * @param {google.api.ICustomHttpPattern=} [properties] Properties to set */ - function Http(properties) { - this.rules = []; + function CustomHttpPattern(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -15448,92 +12274,89 @@ } /** - * Http rules. - * @member {Array.} rules - * @memberof google.api.Http + * CustomHttpPattern kind. + * @member {string} kind + * @memberof google.api.CustomHttpPattern * @instance */ - Http.prototype.rules = $util.emptyArray; + CustomHttpPattern.prototype.kind = ""; /** - * Http fullyDecodeReservedExpansion. - * @member {boolean} fullyDecodeReservedExpansion - * @memberof google.api.Http + * CustomHttpPattern path. + * @member {string} path + * @memberof google.api.CustomHttpPattern * @instance */ - Http.prototype.fullyDecodeReservedExpansion = false; + CustomHttpPattern.prototype.path = ""; /** - * Creates a new Http instance using the specified properties. + * Creates a new CustomHttpPattern instance using the specified properties. * @function create - * @memberof google.api.Http + * @memberof google.api.CustomHttpPattern * @static - * @param {google.api.IHttp=} [properties] Properties to set - * @returns {google.api.Http} Http instance + * @param {google.api.ICustomHttpPattern=} [properties] Properties to set + * @returns {google.api.CustomHttpPattern} CustomHttpPattern instance */ - Http.create = function create(properties) { - return new Http(properties); + CustomHttpPattern.create = function create(properties) { + return new CustomHttpPattern(properties); }; /** - * Encodes the specified Http message. Does not implicitly {@link google.api.Http.verify|verify} messages. + * Encodes the specified CustomHttpPattern message. Does not implicitly {@link google.api.CustomHttpPattern.verify|verify} messages. * @function encode - * @memberof google.api.Http + * @memberof google.api.CustomHttpPattern * @static - * @param {google.api.IHttp} message Http message or plain object to encode + * @param {google.api.ICustomHttpPattern} message CustomHttpPattern message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - Http.encode = function encode(message, writer) { + CustomHttpPattern.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.rules != null && message.rules.length) - for (var i = 0; i < message.rules.length; ++i) - $root.google.api.HttpRule.encode(message.rules[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.fullyDecodeReservedExpansion != null && Object.hasOwnProperty.call(message, "fullyDecodeReservedExpansion")) - writer.uint32(/* id 2, wireType 0 =*/16).bool(message.fullyDecodeReservedExpansion); + if (message.kind != null && Object.hasOwnProperty.call(message, "kind")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.kind); + if (message.path != null && Object.hasOwnProperty.call(message, "path")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.path); return writer; }; /** - * Encodes the specified Http message, length delimited. Does not implicitly {@link google.api.Http.verify|verify} messages. + * Encodes the specified CustomHttpPattern message, length delimited. Does not implicitly {@link google.api.CustomHttpPattern.verify|verify} messages. * @function encodeDelimited - * @memberof google.api.Http + * @memberof google.api.CustomHttpPattern * @static - * @param {google.api.IHttp} message Http message or plain object to encode + * @param {google.api.ICustomHttpPattern} message CustomHttpPattern message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - Http.encodeDelimited = function encodeDelimited(message, writer) { + CustomHttpPattern.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a Http message from the specified reader or buffer. + * Decodes a CustomHttpPattern message from the specified reader or buffer. * @function decode - * @memberof google.api.Http + * @memberof google.api.CustomHttpPattern * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.api.Http} Http + * @returns {google.api.CustomHttpPattern} CustomHttpPattern * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - Http.decode = function decode(reader, length) { + CustomHttpPattern.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.Http(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.CustomHttpPattern(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: { - if (!(message.rules && message.rules.length)) - message.rules = []; - message.rules.push($root.google.api.HttpRule.decode(reader, reader.uint32())); + message.kind = reader.string(); break; } case 2: { - message.fullyDecodeReservedExpansion = reader.bool(); + message.path = reader.string(); break; } default: @@ -15545,158 +12368,139 @@ }; /** - * Decodes a Http message from the specified reader or buffer, length delimited. + * Decodes a CustomHttpPattern message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.api.Http + * @memberof google.api.CustomHttpPattern * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.api.Http} Http + * @returns {google.api.CustomHttpPattern} CustomHttpPattern * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - Http.decodeDelimited = function decodeDelimited(reader) { + CustomHttpPattern.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a Http message. + * Verifies a CustomHttpPattern message. * @function verify - * @memberof google.api.Http + * @memberof google.api.CustomHttpPattern * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - Http.verify = function verify(message) { + CustomHttpPattern.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.rules != null && message.hasOwnProperty("rules")) { - if (!Array.isArray(message.rules)) - return "rules: array expected"; - for (var i = 0; i < message.rules.length; ++i) { - var error = $root.google.api.HttpRule.verify(message.rules[i]); - if (error) - return "rules." + error; - } - } - if (message.fullyDecodeReservedExpansion != null && message.hasOwnProperty("fullyDecodeReservedExpansion")) - if (typeof message.fullyDecodeReservedExpansion !== "boolean") - return "fullyDecodeReservedExpansion: boolean expected"; + if (message.kind != null && message.hasOwnProperty("kind")) + if (!$util.isString(message.kind)) + return "kind: string expected"; + if (message.path != null && message.hasOwnProperty("path")) + if (!$util.isString(message.path)) + return "path: string expected"; return null; }; /** - * Creates a Http message from a plain object. Also converts values to their respective internal types. + * Creates a CustomHttpPattern message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.api.Http + * @memberof google.api.CustomHttpPattern * @static * @param {Object.} object Plain object - * @returns {google.api.Http} Http + * @returns {google.api.CustomHttpPattern} CustomHttpPattern */ - Http.fromObject = function fromObject(object) { - if (object instanceof $root.google.api.Http) + CustomHttpPattern.fromObject = function fromObject(object) { + if (object instanceof $root.google.api.CustomHttpPattern) return object; - var message = new $root.google.api.Http(); - if (object.rules) { - if (!Array.isArray(object.rules)) - throw TypeError(".google.api.Http.rules: array expected"); - message.rules = []; - for (var i = 0; i < object.rules.length; ++i) { - if (typeof object.rules[i] !== "object") - throw TypeError(".google.api.Http.rules: object expected"); - message.rules[i] = $root.google.api.HttpRule.fromObject(object.rules[i]); - } - } - if (object.fullyDecodeReservedExpansion != null) - message.fullyDecodeReservedExpansion = Boolean(object.fullyDecodeReservedExpansion); + var message = new $root.google.api.CustomHttpPattern(); + if (object.kind != null) + message.kind = String(object.kind); + if (object.path != null) + message.path = String(object.path); return message; }; /** - * Creates a plain object from a Http message. Also converts values to other types if specified. + * Creates a plain object from a CustomHttpPattern message. Also converts values to other types if specified. * @function toObject - * @memberof google.api.Http + * @memberof google.api.CustomHttpPattern * @static - * @param {google.api.Http} message Http + * @param {google.api.CustomHttpPattern} message CustomHttpPattern * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - Http.toObject = function toObject(message, options) { + CustomHttpPattern.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.arrays || options.defaults) - object.rules = []; - if (options.defaults) - object.fullyDecodeReservedExpansion = false; - if (message.rules && message.rules.length) { - object.rules = []; - for (var j = 0; j < message.rules.length; ++j) - object.rules[j] = $root.google.api.HttpRule.toObject(message.rules[j], options); - } - if (message.fullyDecodeReservedExpansion != null && message.hasOwnProperty("fullyDecodeReservedExpansion")) - object.fullyDecodeReservedExpansion = message.fullyDecodeReservedExpansion; + if (options.defaults) { + object.kind = ""; + object.path = ""; + } + if (message.kind != null && message.hasOwnProperty("kind")) + object.kind = message.kind; + if (message.path != null && message.hasOwnProperty("path")) + object.path = message.path; return object; }; /** - * Converts this Http to JSON. + * Converts this CustomHttpPattern to JSON. * @function toJSON - * @memberof google.api.Http + * @memberof google.api.CustomHttpPattern * @instance * @returns {Object.} JSON object */ - Http.prototype.toJSON = function toJSON() { + CustomHttpPattern.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; /** - * Gets the default type url for Http + * Gets the default type url for CustomHttpPattern * @function getTypeUrl - * @memberof google.api.Http + * @memberof google.api.CustomHttpPattern * @static * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns {string} The default type url */ - Http.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + CustomHttpPattern.getTypeUrl = function getTypeUrl(typeUrlPrefix) { if (typeUrlPrefix === undefined) { typeUrlPrefix = "type.googleapis.com"; } - return typeUrlPrefix + "/google.api.Http"; + return typeUrlPrefix + "/google.api.CustomHttpPattern"; }; - return Http; + return CustomHttpPattern; })(); - api.HttpRule = (function() { + api.ResourceDescriptor = (function() { /** - * Properties of a HttpRule. + * Properties of a ResourceDescriptor. * @memberof google.api - * @interface IHttpRule - * @property {string|null} [selector] HttpRule selector - * @property {string|null} [get] HttpRule get - * @property {string|null} [put] HttpRule put - * @property {string|null} [post] HttpRule post - * @property {string|null} ["delete"] HttpRule delete - * @property {string|null} [patch] HttpRule patch - * @property {google.api.ICustomHttpPattern|null} [custom] HttpRule custom - * @property {string|null} [body] HttpRule body - * @property {string|null} [responseBody] HttpRule responseBody - * @property {Array.|null} [additionalBindings] HttpRule additionalBindings + * @interface IResourceDescriptor + * @property {string|null} [type] ResourceDescriptor type + * @property {Array.|null} [pattern] ResourceDescriptor pattern + * @property {string|null} [nameField] ResourceDescriptor nameField + * @property {google.api.ResourceDescriptor.History|null} [history] ResourceDescriptor history + * @property {string|null} [plural] ResourceDescriptor plural + * @property {string|null} [singular] ResourceDescriptor singular + * @property {Array.|null} [style] ResourceDescriptor style */ /** - * Constructs a new HttpRule. + * Constructs a new ResourceDescriptor. * @memberof google.api - * @classdesc Represents a HttpRule. - * @implements IHttpRule + * @classdesc Represents a ResourceDescriptor. + * @implements IResourceDescriptor * @constructor - * @param {google.api.IHttpRule=} [properties] Properties to set + * @param {google.api.IResourceDescriptor=} [properties] Properties to set */ - function HttpRule(properties) { - this.additionalBindings = []; + function ResourceDescriptor(properties) { + this.pattern = []; + this.style = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -15704,218 +12508,173 @@ } /** - * HttpRule selector. - * @member {string} selector - * @memberof google.api.HttpRule - * @instance - */ - HttpRule.prototype.selector = ""; - - /** - * HttpRule get. - * @member {string|null|undefined} get - * @memberof google.api.HttpRule - * @instance - */ - HttpRule.prototype.get = null; - - /** - * HttpRule put. - * @member {string|null|undefined} put - * @memberof google.api.HttpRule - * @instance - */ - HttpRule.prototype.put = null; - - /** - * HttpRule post. - * @member {string|null|undefined} post - * @memberof google.api.HttpRule - * @instance - */ - HttpRule.prototype.post = null; - - /** - * HttpRule delete. - * @member {string|null|undefined} delete - * @memberof google.api.HttpRule + * ResourceDescriptor type. + * @member {string} type + * @memberof google.api.ResourceDescriptor * @instance */ - HttpRule.prototype["delete"] = null; + ResourceDescriptor.prototype.type = ""; /** - * HttpRule patch. - * @member {string|null|undefined} patch - * @memberof google.api.HttpRule + * ResourceDescriptor pattern. + * @member {Array.} pattern + * @memberof google.api.ResourceDescriptor * @instance */ - HttpRule.prototype.patch = null; + ResourceDescriptor.prototype.pattern = $util.emptyArray; /** - * HttpRule custom. - * @member {google.api.ICustomHttpPattern|null|undefined} custom - * @memberof google.api.HttpRule + * ResourceDescriptor nameField. + * @member {string} nameField + * @memberof google.api.ResourceDescriptor * @instance */ - HttpRule.prototype.custom = null; + ResourceDescriptor.prototype.nameField = ""; /** - * HttpRule body. - * @member {string} body - * @memberof google.api.HttpRule + * ResourceDescriptor history. + * @member {google.api.ResourceDescriptor.History} history + * @memberof google.api.ResourceDescriptor * @instance */ - HttpRule.prototype.body = ""; + ResourceDescriptor.prototype.history = 0; /** - * HttpRule responseBody. - * @member {string} responseBody - * @memberof google.api.HttpRule + * ResourceDescriptor plural. + * @member {string} plural + * @memberof google.api.ResourceDescriptor * @instance */ - HttpRule.prototype.responseBody = ""; + ResourceDescriptor.prototype.plural = ""; /** - * HttpRule additionalBindings. - * @member {Array.} additionalBindings - * @memberof google.api.HttpRule + * ResourceDescriptor singular. + * @member {string} singular + * @memberof google.api.ResourceDescriptor * @instance */ - HttpRule.prototype.additionalBindings = $util.emptyArray; - - // OneOf field names bound to virtual getters and setters - var $oneOfFields; + ResourceDescriptor.prototype.singular = ""; /** - * HttpRule pattern. - * @member {"get"|"put"|"post"|"delete"|"patch"|"custom"|undefined} pattern - * @memberof google.api.HttpRule + * ResourceDescriptor style. + * @member {Array.} style + * @memberof google.api.ResourceDescriptor * @instance */ - Object.defineProperty(HttpRule.prototype, "pattern", { - get: $util.oneOfGetter($oneOfFields = ["get", "put", "post", "delete", "patch", "custom"]), - set: $util.oneOfSetter($oneOfFields) - }); + ResourceDescriptor.prototype.style = $util.emptyArray; /** - * Creates a new HttpRule instance using the specified properties. + * Creates a new ResourceDescriptor instance using the specified properties. * @function create - * @memberof google.api.HttpRule + * @memberof google.api.ResourceDescriptor * @static - * @param {google.api.IHttpRule=} [properties] Properties to set - * @returns {google.api.HttpRule} HttpRule instance + * @param {google.api.IResourceDescriptor=} [properties] Properties to set + * @returns {google.api.ResourceDescriptor} ResourceDescriptor instance */ - HttpRule.create = function create(properties) { - return new HttpRule(properties); + ResourceDescriptor.create = function create(properties) { + return new ResourceDescriptor(properties); }; /** - * Encodes the specified HttpRule message. Does not implicitly {@link google.api.HttpRule.verify|verify} messages. + * Encodes the specified ResourceDescriptor message. Does not implicitly {@link google.api.ResourceDescriptor.verify|verify} messages. * @function encode - * @memberof google.api.HttpRule + * @memberof google.api.ResourceDescriptor * @static - * @param {google.api.IHttpRule} message HttpRule message or plain object to encode + * @param {google.api.IResourceDescriptor} message ResourceDescriptor message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - HttpRule.encode = function encode(message, writer) { + ResourceDescriptor.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.selector != null && Object.hasOwnProperty.call(message, "selector")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.selector); - if (message.get != null && Object.hasOwnProperty.call(message, "get")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.get); - if (message.put != null && Object.hasOwnProperty.call(message, "put")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.put); - if (message.post != null && Object.hasOwnProperty.call(message, "post")) - writer.uint32(/* id 4, wireType 2 =*/34).string(message.post); - if (message["delete"] != null && Object.hasOwnProperty.call(message, "delete")) - writer.uint32(/* id 5, wireType 2 =*/42).string(message["delete"]); - if (message.patch != null && Object.hasOwnProperty.call(message, "patch")) - writer.uint32(/* id 6, wireType 2 =*/50).string(message.patch); - if (message.body != null && Object.hasOwnProperty.call(message, "body")) - writer.uint32(/* id 7, wireType 2 =*/58).string(message.body); - if (message.custom != null && Object.hasOwnProperty.call(message, "custom")) - $root.google.api.CustomHttpPattern.encode(message.custom, writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); - if (message.additionalBindings != null && message.additionalBindings.length) - for (var i = 0; i < message.additionalBindings.length; ++i) - $root.google.api.HttpRule.encode(message.additionalBindings[i], writer.uint32(/* id 11, wireType 2 =*/90).fork()).ldelim(); - if (message.responseBody != null && Object.hasOwnProperty.call(message, "responseBody")) - writer.uint32(/* id 12, wireType 2 =*/98).string(message.responseBody); + if (message.type != null && Object.hasOwnProperty.call(message, "type")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.type); + if (message.pattern != null && message.pattern.length) + for (var i = 0; i < message.pattern.length; ++i) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.pattern[i]); + if (message.nameField != null && Object.hasOwnProperty.call(message, "nameField")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.nameField); + if (message.history != null && Object.hasOwnProperty.call(message, "history")) + writer.uint32(/* id 4, wireType 0 =*/32).int32(message.history); + if (message.plural != null && Object.hasOwnProperty.call(message, "plural")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.plural); + if (message.singular != null && Object.hasOwnProperty.call(message, "singular")) + writer.uint32(/* id 6, wireType 2 =*/50).string(message.singular); + if (message.style != null && message.style.length) { + writer.uint32(/* id 10, wireType 2 =*/82).fork(); + for (var i = 0; i < message.style.length; ++i) + writer.int32(message.style[i]); + writer.ldelim(); + } return writer; }; /** - * Encodes the specified HttpRule message, length delimited. Does not implicitly {@link google.api.HttpRule.verify|verify} messages. + * Encodes the specified ResourceDescriptor message, length delimited. Does not implicitly {@link google.api.ResourceDescriptor.verify|verify} messages. * @function encodeDelimited - * @memberof google.api.HttpRule + * @memberof google.api.ResourceDescriptor * @static - * @param {google.api.IHttpRule} message HttpRule message or plain object to encode + * @param {google.api.IResourceDescriptor} message ResourceDescriptor message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - HttpRule.encodeDelimited = function encodeDelimited(message, writer) { + ResourceDescriptor.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a HttpRule message from the specified reader or buffer. + * Decodes a ResourceDescriptor message from the specified reader or buffer. * @function decode - * @memberof google.api.HttpRule + * @memberof google.api.ResourceDescriptor * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.api.HttpRule} HttpRule + * @returns {google.api.ResourceDescriptor} ResourceDescriptor * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - HttpRule.decode = function decode(reader, length) { + ResourceDescriptor.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.HttpRule(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.ResourceDescriptor(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: { - message.selector = reader.string(); + message.type = reader.string(); break; } case 2: { - message.get = reader.string(); + if (!(message.pattern && message.pattern.length)) + message.pattern = []; + message.pattern.push(reader.string()); break; } case 3: { - message.put = reader.string(); + message.nameField = reader.string(); break; } case 4: { - message.post = reader.string(); + message.history = reader.int32(); break; } case 5: { - message["delete"] = reader.string(); - break; - } - case 6: { - message.patch = reader.string(); - break; - } - case 8: { - message.custom = $root.google.api.CustomHttpPattern.decode(reader, reader.uint32()); - break; - } - case 7: { - message.body = reader.string(); + message.plural = reader.string(); break; - } - case 12: { - message.responseBody = reader.string(); + } + case 6: { + message.singular = reader.string(); break; } - case 11: { - if (!(message.additionalBindings && message.additionalBindings.length)) - message.additionalBindings = []; - message.additionalBindings.push($root.google.api.HttpRule.decode(reader, reader.uint32())); + case 10: { + if (!(message.style && message.style.length)) + message.style = []; + if ((tag & 7) === 2) { + var end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) + message.style.push(reader.int32()); + } else + message.style.push(reader.int32()); break; } default: @@ -15927,255 +12686,271 @@ }; /** - * Decodes a HttpRule message from the specified reader or buffer, length delimited. + * Decodes a ResourceDescriptor message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.api.HttpRule + * @memberof google.api.ResourceDescriptor * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.api.HttpRule} HttpRule + * @returns {google.api.ResourceDescriptor} ResourceDescriptor * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - HttpRule.decodeDelimited = function decodeDelimited(reader) { + ResourceDescriptor.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a HttpRule message. + * Verifies a ResourceDescriptor message. * @function verify - * @memberof google.api.HttpRule + * @memberof google.api.ResourceDescriptor * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - HttpRule.verify = function verify(message) { + ResourceDescriptor.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - var properties = {}; - if (message.selector != null && message.hasOwnProperty("selector")) - if (!$util.isString(message.selector)) - return "selector: string expected"; - if (message.get != null && message.hasOwnProperty("get")) { - properties.pattern = 1; - if (!$util.isString(message.get)) - return "get: string expected"; - } - if (message.put != null && message.hasOwnProperty("put")) { - if (properties.pattern === 1) - return "pattern: multiple values"; - properties.pattern = 1; - if (!$util.isString(message.put)) - return "put: string expected"; - } - if (message.post != null && message.hasOwnProperty("post")) { - if (properties.pattern === 1) - return "pattern: multiple values"; - properties.pattern = 1; - if (!$util.isString(message.post)) - return "post: string expected"; - } - if (message["delete"] != null && message.hasOwnProperty("delete")) { - if (properties.pattern === 1) - return "pattern: multiple values"; - properties.pattern = 1; - if (!$util.isString(message["delete"])) - return "delete: string expected"; - } - if (message.patch != null && message.hasOwnProperty("patch")) { - if (properties.pattern === 1) - return "pattern: multiple values"; - properties.pattern = 1; - if (!$util.isString(message.patch)) - return "patch: string expected"; - } - if (message.custom != null && message.hasOwnProperty("custom")) { - if (properties.pattern === 1) - return "pattern: multiple values"; - properties.pattern = 1; - { - var error = $root.google.api.CustomHttpPattern.verify(message.custom); - if (error) - return "custom." + error; - } + if (message.type != null && message.hasOwnProperty("type")) + if (!$util.isString(message.type)) + return "type: string expected"; + if (message.pattern != null && message.hasOwnProperty("pattern")) { + if (!Array.isArray(message.pattern)) + return "pattern: array expected"; + for (var i = 0; i < message.pattern.length; ++i) + if (!$util.isString(message.pattern[i])) + return "pattern: string[] expected"; } - if (message.body != null && message.hasOwnProperty("body")) - if (!$util.isString(message.body)) - return "body: string expected"; - if (message.responseBody != null && message.hasOwnProperty("responseBody")) - if (!$util.isString(message.responseBody)) - return "responseBody: string expected"; - if (message.additionalBindings != null && message.hasOwnProperty("additionalBindings")) { - if (!Array.isArray(message.additionalBindings)) - return "additionalBindings: array expected"; - for (var i = 0; i < message.additionalBindings.length; ++i) { - var error = $root.google.api.HttpRule.verify(message.additionalBindings[i]); - if (error) - return "additionalBindings." + error; + if (message.nameField != null && message.hasOwnProperty("nameField")) + if (!$util.isString(message.nameField)) + return "nameField: string expected"; + if (message.history != null && message.hasOwnProperty("history")) + switch (message.history) { + default: + return "history: enum value expected"; + case 0: + case 1: + case 2: + break; } + if (message.plural != null && message.hasOwnProperty("plural")) + if (!$util.isString(message.plural)) + return "plural: string expected"; + if (message.singular != null && message.hasOwnProperty("singular")) + if (!$util.isString(message.singular)) + return "singular: string expected"; + if (message.style != null && message.hasOwnProperty("style")) { + if (!Array.isArray(message.style)) + return "style: array expected"; + for (var i = 0; i < message.style.length; ++i) + switch (message.style[i]) { + default: + return "style: enum value[] expected"; + case 0: + case 1: + break; + } } return null; }; /** - * Creates a HttpRule message from a plain object. Also converts values to their respective internal types. + * Creates a ResourceDescriptor message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.api.HttpRule + * @memberof google.api.ResourceDescriptor * @static * @param {Object.} object Plain object - * @returns {google.api.HttpRule} HttpRule + * @returns {google.api.ResourceDescriptor} ResourceDescriptor */ - HttpRule.fromObject = function fromObject(object) { - if (object instanceof $root.google.api.HttpRule) + ResourceDescriptor.fromObject = function fromObject(object) { + if (object instanceof $root.google.api.ResourceDescriptor) return object; - var message = new $root.google.api.HttpRule(); - if (object.selector != null) - message.selector = String(object.selector); - if (object.get != null) - message.get = String(object.get); - if (object.put != null) - message.put = String(object.put); - if (object.post != null) - message.post = String(object.post); - if (object["delete"] != null) - message["delete"] = String(object["delete"]); - if (object.patch != null) - message.patch = String(object.patch); - if (object.custom != null) { - if (typeof object.custom !== "object") - throw TypeError(".google.api.HttpRule.custom: object expected"); - message.custom = $root.google.api.CustomHttpPattern.fromObject(object.custom); + var message = new $root.google.api.ResourceDescriptor(); + if (object.type != null) + message.type = String(object.type); + if (object.pattern) { + if (!Array.isArray(object.pattern)) + throw TypeError(".google.api.ResourceDescriptor.pattern: array expected"); + message.pattern = []; + for (var i = 0; i < object.pattern.length; ++i) + message.pattern[i] = String(object.pattern[i]); } - if (object.body != null) - message.body = String(object.body); - if (object.responseBody != null) - message.responseBody = String(object.responseBody); - if (object.additionalBindings) { - if (!Array.isArray(object.additionalBindings)) - throw TypeError(".google.api.HttpRule.additionalBindings: array expected"); - message.additionalBindings = []; - for (var i = 0; i < object.additionalBindings.length; ++i) { - if (typeof object.additionalBindings[i] !== "object") - throw TypeError(".google.api.HttpRule.additionalBindings: object expected"); - message.additionalBindings[i] = $root.google.api.HttpRule.fromObject(object.additionalBindings[i]); + if (object.nameField != null) + message.nameField = String(object.nameField); + switch (object.history) { + default: + if (typeof object.history === "number") { + message.history = object.history; + break; } + break; + case "HISTORY_UNSPECIFIED": + case 0: + message.history = 0; + break; + case "ORIGINALLY_SINGLE_PATTERN": + case 1: + message.history = 1; + break; + case "FUTURE_MULTI_PATTERN": + case 2: + message.history = 2; + break; + } + if (object.plural != null) + message.plural = String(object.plural); + if (object.singular != null) + message.singular = String(object.singular); + if (object.style) { + if (!Array.isArray(object.style)) + throw TypeError(".google.api.ResourceDescriptor.style: array expected"); + message.style = []; + for (var i = 0; i < object.style.length; ++i) + switch (object.style[i]) { + default: + if (typeof object.style[i] === "number") { + message.style[i] = object.style[i]; + break; + } + case "STYLE_UNSPECIFIED": + case 0: + message.style[i] = 0; + break; + case "DECLARATIVE_FRIENDLY": + case 1: + message.style[i] = 1; + break; + } } return message; }; /** - * Creates a plain object from a HttpRule message. Also converts values to other types if specified. + * Creates a plain object from a ResourceDescriptor message. Also converts values to other types if specified. * @function toObject - * @memberof google.api.HttpRule + * @memberof google.api.ResourceDescriptor * @static - * @param {google.api.HttpRule} message HttpRule + * @param {google.api.ResourceDescriptor} message ResourceDescriptor * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - HttpRule.toObject = function toObject(message, options) { + ResourceDescriptor.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.arrays || options.defaults) - object.additionalBindings = []; - if (options.defaults) { - object.selector = ""; - object.body = ""; - object.responseBody = ""; - } - if (message.selector != null && message.hasOwnProperty("selector")) - object.selector = message.selector; - if (message.get != null && message.hasOwnProperty("get")) { - object.get = message.get; - if (options.oneofs) - object.pattern = "get"; - } - if (message.put != null && message.hasOwnProperty("put")) { - object.put = message.put; - if (options.oneofs) - object.pattern = "put"; - } - if (message.post != null && message.hasOwnProperty("post")) { - object.post = message.post; - if (options.oneofs) - object.pattern = "post"; - } - if (message["delete"] != null && message.hasOwnProperty("delete")) { - object["delete"] = message["delete"]; - if (options.oneofs) - object.pattern = "delete"; + if (options.arrays || options.defaults) { + object.pattern = []; + object.style = []; } - if (message.patch != null && message.hasOwnProperty("patch")) { - object.patch = message.patch; - if (options.oneofs) - object.pattern = "patch"; + if (options.defaults) { + object.type = ""; + object.nameField = ""; + object.history = options.enums === String ? "HISTORY_UNSPECIFIED" : 0; + object.plural = ""; + object.singular = ""; } - if (message.body != null && message.hasOwnProperty("body")) - object.body = message.body; - if (message.custom != null && message.hasOwnProperty("custom")) { - object.custom = $root.google.api.CustomHttpPattern.toObject(message.custom, options); - if (options.oneofs) - object.pattern = "custom"; + if (message.type != null && message.hasOwnProperty("type")) + object.type = message.type; + if (message.pattern && message.pattern.length) { + object.pattern = []; + for (var j = 0; j < message.pattern.length; ++j) + object.pattern[j] = message.pattern[j]; } - if (message.additionalBindings && message.additionalBindings.length) { - object.additionalBindings = []; - for (var j = 0; j < message.additionalBindings.length; ++j) - object.additionalBindings[j] = $root.google.api.HttpRule.toObject(message.additionalBindings[j], options); + if (message.nameField != null && message.hasOwnProperty("nameField")) + object.nameField = message.nameField; + if (message.history != null && message.hasOwnProperty("history")) + object.history = options.enums === String ? $root.google.api.ResourceDescriptor.History[message.history] === undefined ? message.history : $root.google.api.ResourceDescriptor.History[message.history] : message.history; + if (message.plural != null && message.hasOwnProperty("plural")) + object.plural = message.plural; + if (message.singular != null && message.hasOwnProperty("singular")) + object.singular = message.singular; + if (message.style && message.style.length) { + object.style = []; + for (var j = 0; j < message.style.length; ++j) + object.style[j] = options.enums === String ? $root.google.api.ResourceDescriptor.Style[message.style[j]] === undefined ? message.style[j] : $root.google.api.ResourceDescriptor.Style[message.style[j]] : message.style[j]; } - if (message.responseBody != null && message.hasOwnProperty("responseBody")) - object.responseBody = message.responseBody; return object; }; /** - * Converts this HttpRule to JSON. + * Converts this ResourceDescriptor to JSON. * @function toJSON - * @memberof google.api.HttpRule + * @memberof google.api.ResourceDescriptor * @instance * @returns {Object.} JSON object */ - HttpRule.prototype.toJSON = function toJSON() { + ResourceDescriptor.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; /** - * Gets the default type url for HttpRule + * Gets the default type url for ResourceDescriptor * @function getTypeUrl - * @memberof google.api.HttpRule + * @memberof google.api.ResourceDescriptor * @static * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns {string} The default type url */ - HttpRule.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + ResourceDescriptor.getTypeUrl = function getTypeUrl(typeUrlPrefix) { if (typeUrlPrefix === undefined) { typeUrlPrefix = "type.googleapis.com"; } - return typeUrlPrefix + "/google.api.HttpRule"; + return typeUrlPrefix + "/google.api.ResourceDescriptor"; }; - return HttpRule; + /** + * History enum. + * @name google.api.ResourceDescriptor.History + * @enum {number} + * @property {number} HISTORY_UNSPECIFIED=0 HISTORY_UNSPECIFIED value + * @property {number} ORIGINALLY_SINGLE_PATTERN=1 ORIGINALLY_SINGLE_PATTERN value + * @property {number} FUTURE_MULTI_PATTERN=2 FUTURE_MULTI_PATTERN value + */ + ResourceDescriptor.History = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "HISTORY_UNSPECIFIED"] = 0; + values[valuesById[1] = "ORIGINALLY_SINGLE_PATTERN"] = 1; + values[valuesById[2] = "FUTURE_MULTI_PATTERN"] = 2; + return values; + })(); + + /** + * Style enum. + * @name google.api.ResourceDescriptor.Style + * @enum {number} + * @property {number} STYLE_UNSPECIFIED=0 STYLE_UNSPECIFIED value + * @property {number} DECLARATIVE_FRIENDLY=1 DECLARATIVE_FRIENDLY value + */ + ResourceDescriptor.Style = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "STYLE_UNSPECIFIED"] = 0; + values[valuesById[1] = "DECLARATIVE_FRIENDLY"] = 1; + return values; + })(); + + return ResourceDescriptor; })(); - api.CustomHttpPattern = (function() { + api.ResourceReference = (function() { /** - * Properties of a CustomHttpPattern. + * Properties of a ResourceReference. * @memberof google.api - * @interface ICustomHttpPattern - * @property {string|null} [kind] CustomHttpPattern kind - * @property {string|null} [path] CustomHttpPattern path + * @interface IResourceReference + * @property {string|null} [type] ResourceReference type + * @property {string|null} [childType] ResourceReference childType */ /** - * Constructs a new CustomHttpPattern. + * Constructs a new ResourceReference. * @memberof google.api - * @classdesc Represents a CustomHttpPattern. - * @implements ICustomHttpPattern + * @classdesc Represents a ResourceReference. + * @implements IResourceReference * @constructor - * @param {google.api.ICustomHttpPattern=} [properties] Properties to set + * @param {google.api.IResourceReference=} [properties] Properties to set */ - function CustomHttpPattern(properties) { + function ResourceReference(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -16183,89 +12958,89 @@ } /** - * CustomHttpPattern kind. - * @member {string} kind - * @memberof google.api.CustomHttpPattern + * ResourceReference type. + * @member {string} type + * @memberof google.api.ResourceReference * @instance */ - CustomHttpPattern.prototype.kind = ""; + ResourceReference.prototype.type = ""; /** - * CustomHttpPattern path. - * @member {string} path - * @memberof google.api.CustomHttpPattern + * ResourceReference childType. + * @member {string} childType + * @memberof google.api.ResourceReference * @instance */ - CustomHttpPattern.prototype.path = ""; + ResourceReference.prototype.childType = ""; /** - * Creates a new CustomHttpPattern instance using the specified properties. + * Creates a new ResourceReference instance using the specified properties. * @function create - * @memberof google.api.CustomHttpPattern + * @memberof google.api.ResourceReference * @static - * @param {google.api.ICustomHttpPattern=} [properties] Properties to set - * @returns {google.api.CustomHttpPattern} CustomHttpPattern instance + * @param {google.api.IResourceReference=} [properties] Properties to set + * @returns {google.api.ResourceReference} ResourceReference instance */ - CustomHttpPattern.create = function create(properties) { - return new CustomHttpPattern(properties); + ResourceReference.create = function create(properties) { + return new ResourceReference(properties); }; /** - * Encodes the specified CustomHttpPattern message. Does not implicitly {@link google.api.CustomHttpPattern.verify|verify} messages. + * Encodes the specified ResourceReference message. Does not implicitly {@link google.api.ResourceReference.verify|verify} messages. * @function encode - * @memberof google.api.CustomHttpPattern + * @memberof google.api.ResourceReference * @static - * @param {google.api.ICustomHttpPattern} message CustomHttpPattern message or plain object to encode + * @param {google.api.IResourceReference} message ResourceReference message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - CustomHttpPattern.encode = function encode(message, writer) { + ResourceReference.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.kind != null && Object.hasOwnProperty.call(message, "kind")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.kind); - if (message.path != null && Object.hasOwnProperty.call(message, "path")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.path); + if (message.type != null && Object.hasOwnProperty.call(message, "type")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.type); + if (message.childType != null && Object.hasOwnProperty.call(message, "childType")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.childType); return writer; }; /** - * Encodes the specified CustomHttpPattern message, length delimited. Does not implicitly {@link google.api.CustomHttpPattern.verify|verify} messages. + * Encodes the specified ResourceReference message, length delimited. Does not implicitly {@link google.api.ResourceReference.verify|verify} messages. * @function encodeDelimited - * @memberof google.api.CustomHttpPattern + * @memberof google.api.ResourceReference * @static - * @param {google.api.ICustomHttpPattern} message CustomHttpPattern message or plain object to encode + * @param {google.api.IResourceReference} message ResourceReference message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - CustomHttpPattern.encodeDelimited = function encodeDelimited(message, writer) { + ResourceReference.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a CustomHttpPattern message from the specified reader or buffer. + * Decodes a ResourceReference message from the specified reader or buffer. * @function decode - * @memberof google.api.CustomHttpPattern + * @memberof google.api.ResourceReference * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.api.CustomHttpPattern} CustomHttpPattern + * @returns {google.api.ResourceReference} ResourceReference * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - CustomHttpPattern.decode = function decode(reader, length) { + ResourceReference.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.CustomHttpPattern(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.ResourceReference(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: { - message.kind = reader.string(); + message.type = reader.string(); break; } case 2: { - message.path = reader.string(); + message.childType = reader.string(); break; } default: @@ -16277,111 +13052,111 @@ }; /** - * Decodes a CustomHttpPattern message from the specified reader or buffer, length delimited. + * Decodes a ResourceReference message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.api.CustomHttpPattern + * @memberof google.api.ResourceReference * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.api.CustomHttpPattern} CustomHttpPattern + * @returns {google.api.ResourceReference} ResourceReference * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - CustomHttpPattern.decodeDelimited = function decodeDelimited(reader) { + ResourceReference.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a CustomHttpPattern message. + * Verifies a ResourceReference message. * @function verify - * @memberof google.api.CustomHttpPattern + * @memberof google.api.ResourceReference * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - CustomHttpPattern.verify = function verify(message) { + ResourceReference.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.kind != null && message.hasOwnProperty("kind")) - if (!$util.isString(message.kind)) - return "kind: string expected"; - if (message.path != null && message.hasOwnProperty("path")) - if (!$util.isString(message.path)) - return "path: string expected"; + if (message.type != null && message.hasOwnProperty("type")) + if (!$util.isString(message.type)) + return "type: string expected"; + if (message.childType != null && message.hasOwnProperty("childType")) + if (!$util.isString(message.childType)) + return "childType: string expected"; return null; }; /** - * Creates a CustomHttpPattern message from a plain object. Also converts values to their respective internal types. + * Creates a ResourceReference message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.api.CustomHttpPattern + * @memberof google.api.ResourceReference * @static * @param {Object.} object Plain object - * @returns {google.api.CustomHttpPattern} CustomHttpPattern + * @returns {google.api.ResourceReference} ResourceReference */ - CustomHttpPattern.fromObject = function fromObject(object) { - if (object instanceof $root.google.api.CustomHttpPattern) + ResourceReference.fromObject = function fromObject(object) { + if (object instanceof $root.google.api.ResourceReference) return object; - var message = new $root.google.api.CustomHttpPattern(); - if (object.kind != null) - message.kind = String(object.kind); - if (object.path != null) - message.path = String(object.path); + var message = new $root.google.api.ResourceReference(); + if (object.type != null) + message.type = String(object.type); + if (object.childType != null) + message.childType = String(object.childType); return message; }; /** - * Creates a plain object from a CustomHttpPattern message. Also converts values to other types if specified. + * Creates a plain object from a ResourceReference message. Also converts values to other types if specified. * @function toObject - * @memberof google.api.CustomHttpPattern + * @memberof google.api.ResourceReference * @static - * @param {google.api.CustomHttpPattern} message CustomHttpPattern + * @param {google.api.ResourceReference} message ResourceReference * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - CustomHttpPattern.toObject = function toObject(message, options) { + ResourceReference.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (options.defaults) { - object.kind = ""; - object.path = ""; + object.type = ""; + object.childType = ""; } - if (message.kind != null && message.hasOwnProperty("kind")) - object.kind = message.kind; - if (message.path != null && message.hasOwnProperty("path")) - object.path = message.path; + if (message.type != null && message.hasOwnProperty("type")) + object.type = message.type; + if (message.childType != null && message.hasOwnProperty("childType")) + object.childType = message.childType; return object; }; /** - * Converts this CustomHttpPattern to JSON. + * Converts this ResourceReference to JSON. * @function toJSON - * @memberof google.api.CustomHttpPattern + * @memberof google.api.ResourceReference * @instance * @returns {Object.} JSON object */ - CustomHttpPattern.prototype.toJSON = function toJSON() { + ResourceReference.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; /** - * Gets the default type url for CustomHttpPattern + * Gets the default type url for ResourceReference * @function getTypeUrl - * @memberof google.api.CustomHttpPattern + * @memberof google.api.ResourceReference * @static * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns {string} The default type url */ - CustomHttpPattern.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + ResourceReference.getTypeUrl = function getTypeUrl(typeUrlPrefix) { if (typeUrlPrefix === undefined) { typeUrlPrefix = "type.googleapis.com"; } - return typeUrlPrefix + "/google.api.CustomHttpPattern"; + return typeUrlPrefix + "/google.api.ResourceReference"; }; - return CustomHttpPattern; + return ResourceReference; })(); return api; diff --git a/packages/google-cloud-networkconnectivity/protos/protos.json b/packages/google-cloud-networkconnectivity/protos/protos.json index f1b6bb1b47a..60b822b27ad 100644 --- a/packages/google-cloud-networkconnectivity/protos/protos.json +++ b/packages/google-cloud-networkconnectivity/protos/protos.json @@ -11,12 +11,12 @@ "csharp_namespace": "Google.Cloud.NetworkConnectivity.V1", "go_package": "google.golang.org/genproto/googleapis/cloud/networkconnectivity/v1;networkconnectivity", "java_multiple_files": true, - "java_outer_classname": "PolicyBasedRoutingProto", + "java_outer_classname": "HubProto", "java_package": "com.google.cloud.networkconnectivity.v1", "php_namespace": "Google\\Cloud\\NetworkConnectivity\\V1", "ruby_package": "Google::Cloud::NetworkConnectivity::V1", - "(google.api.resource_definition).type": "compute.googleapis.com/Instance", - "(google.api.resource_definition).pattern": "projects/{project}/zones/{zone}/instances/{instance}" + "(google.api.resource_definition).type": "compute.googleapis.com/Network", + "(google.api.resource_definition).pattern": "projects/{project}/global/networks/{resource_id}" }, "nested": { "OperationMetadata": { @@ -316,20 +316,19 @@ } } }, - "LocationFeature": { - "values": { - "LOCATION_FEATURE_UNSPECIFIED": 0, - "SITE_TO_CLOUD_SPOKES": 1, - "SITE_TO_SITE_SPOKES": 2 - } - }, "State": { "values": { "STATE_UNSPECIFIED": 0, "CREATING": 1, "ACTIVE": 2, - "DELETING": 3, - "UPDATING": 6 + "DELETING": 3 + } + }, + "LocationFeature": { + "values": { + "LOCATION_FEATURE_UNSPECIFIED": 0, + "SITE_TO_CLOUD_SPOKES": 1, + "SITE_TO_SITE_SPOKES": 2 } }, "Hub": { @@ -762,14 +761,6 @@ "siteToSiteDataTransfer": { "type": "bool", "id": 2 - }, - "vpcNetwork": { - "type": "string", - "id": 3, - "options": { - "(google.api.field_behavior)": "OUTPUT_ONLY", - "(google.api.resource_reference).type": "compute.googleapis.com/Network" - } } } }, @@ -786,14 +777,6 @@ "siteToSiteDataTransfer": { "type": "bool", "id": 2 - }, - "vpcNetwork": { - "type": "string", - "id": 3, - "options": { - "(google.api.field_behavior)": "OUTPUT_ONLY", - "(google.api.resource_reference).type": "compute.googleapis.com/Network" - } } } }, @@ -807,14 +790,6 @@ "siteToSiteDataTransfer": { "type": "bool", "id": 2 - }, - "vpcNetwork": { - "type": "string", - "id": 3, - "options": { - "(google.api.field_behavior)": "OUTPUT_ONLY", - "(google.api.resource_reference).type": "compute.googleapis.com/Network" - } } } }, @@ -841,433 +816,6 @@ "id": 1 } } - }, - "PolicyBasedRoutingService": { - "options": { - "(google.api.default_host)": "networkconnectivity.googleapis.com", - "(google.api.oauth_scopes)": "https://www.googleapis.com/auth/cloud-platform" - }, - "methods": { - "ListPolicyBasedRoutes": { - "requestType": "ListPolicyBasedRoutesRequest", - "responseType": "ListPolicyBasedRoutesResponse", - "options": { - "(google.api.http).get": "/v1/{parent=projects/*/locations/global}/policyBasedRoutes", - "(google.api.method_signature)": "parent" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "get": "/v1/{parent=projects/*/locations/global}/policyBasedRoutes" - } - }, - { - "(google.api.method_signature)": "parent" - } - ] - }, - "GetPolicyBasedRoute": { - "requestType": "GetPolicyBasedRouteRequest", - "responseType": "PolicyBasedRoute", - "options": { - "(google.api.http).get": "/v1/{name=projects/*/locations/global/policyBasedRoutes/*}", - "(google.api.method_signature)": "name" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "get": "/v1/{name=projects/*/locations/global/policyBasedRoutes/*}" - } - }, - { - "(google.api.method_signature)": "name" - } - ] - }, - "CreatePolicyBasedRoute": { - "requestType": "CreatePolicyBasedRouteRequest", - "responseType": "google.longrunning.Operation", - "options": { - "(google.api.http).post": "/v1/{parent=projects/*/locations/global}/policyBasedRoutes", - "(google.api.http).body": "policy_based_route", - "(google.api.method_signature)": "parent,policy_based_route,policy_based_route_id", - "(google.longrunning.operation_info).response_type": "PolicyBasedRoute", - "(google.longrunning.operation_info).metadata_type": "OperationMetadata" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "post": "/v1/{parent=projects/*/locations/global}/policyBasedRoutes", - "body": "policy_based_route" - } - }, - { - "(google.api.method_signature)": "parent,policy_based_route,policy_based_route_id" - }, - { - "(google.longrunning.operation_info)": { - "response_type": "PolicyBasedRoute", - "metadata_type": "OperationMetadata" - } - } - ] - }, - "DeletePolicyBasedRoute": { - "requestType": "DeletePolicyBasedRouteRequest", - "responseType": "google.longrunning.Operation", - "options": { - "(google.api.http).delete": "/v1/{name=projects/*/locations/global/policyBasedRoutes/*}", - "(google.api.method_signature)": "name", - "(google.longrunning.operation_info).response_type": "google.protobuf.Empty", - "(google.longrunning.operation_info).metadata_type": "OperationMetadata" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "delete": "/v1/{name=projects/*/locations/global/policyBasedRoutes/*}" - } - }, - { - "(google.api.method_signature)": "name" - }, - { - "(google.longrunning.operation_info)": { - "response_type": "google.protobuf.Empty", - "metadata_type": "OperationMetadata" - } - } - ] - } - } - }, - "PolicyBasedRoute": { - "options": { - "(google.api.resource).type": "networkconnectivity.googleapis.com/PolicyBasedRoute", - "(google.api.resource).pattern": "projects/{project}/{location}/global/PolicyBasedRoutes/{policy_based_route}" - }, - "oneofs": { - "target": { - "oneof": [ - "virtualMachine", - "interconnectAttachment" - ] - }, - "nextHop": { - "oneof": [ - "nextHopIlbIp" - ] - } - }, - "fields": { - "virtualMachine": { - "type": "VirtualMachine", - "id": 18, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - }, - "interconnectAttachment": { - "type": "InterconnectAttachment", - "id": 9, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - }, - "nextHopIlbIp": { - "type": "string", - "id": 12, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - }, - "name": { - "type": "string", - "id": 1, - "options": { - "(google.api.field_behavior)": "IMMUTABLE" - } - }, - "createTime": { - "type": "google.protobuf.Timestamp", - "id": 2, - "options": { - "(google.api.field_behavior)": "OUTPUT_ONLY" - } - }, - "updateTime": { - "type": "google.protobuf.Timestamp", - "id": 3, - "options": { - "(google.api.field_behavior)": "OUTPUT_ONLY" - } - }, - "labels": { - "keyType": "string", - "type": "string", - "id": 4 - }, - "description": { - "type": "string", - "id": 5, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - }, - "network": { - "type": "string", - "id": 6, - "options": { - "(google.api.field_behavior)": "REQUIRED", - "(google.api.resource_reference).type": "compute.googleapis.com/Network" - } - }, - "filter": { - "type": "Filter", - "id": 10, - "options": { - "(google.api.field_behavior)": "REQUIRED" - } - }, - "priority": { - "type": "int32", - "id": 11, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - }, - "warnings": { - "rule": "repeated", - "type": "Warnings", - "id": 14, - "options": { - "(google.api.field_behavior)": "OUTPUT_ONLY" - } - }, - "selfLink": { - "type": "string", - "id": 15, - "options": { - "(google.api.field_behavior)": "OUTPUT_ONLY" - } - }, - "kind": { - "type": "string", - "id": 16, - "options": { - "(google.api.field_behavior)": "OUTPUT_ONLY" - } - } - }, - "nested": { - "VirtualMachine": { - "fields": { - "tags": { - "rule": "repeated", - "type": "string", - "id": 1, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - } - } - }, - "InterconnectAttachment": { - "fields": { - "region": { - "type": "string", - "id": 1, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - } - } - }, - "Filter": { - "fields": { - "ipProtocol": { - "type": "string", - "id": 1, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - }, - "srcRange": { - "type": "string", - "id": 2, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - }, - "destRange": { - "type": "string", - "id": 3, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - }, - "protocolVersion": { - "type": "ProtocolVersion", - "id": 6, - "options": { - "(google.api.field_behavior)": "REQUIRED" - } - } - }, - "nested": { - "ProtocolVersion": { - "values": { - "PROTOCOL_VERSION_UNSPECIFIED": 0, - "IPV4": 1 - } - } - } - }, - "Warnings": { - "fields": { - "code": { - "type": "Code", - "id": 1, - "options": { - "(google.api.field_behavior)": "OUTPUT_ONLY" - } - }, - "data": { - "keyType": "string", - "type": "string", - "id": 2, - "options": { - "(google.api.field_behavior)": "OUTPUT_ONLY" - } - }, - "warningMessage": { - "type": "string", - "id": 3, - "options": { - "(google.api.field_behavior)": "OUTPUT_ONLY" - } - } - }, - "nested": { - "Code": { - "values": { - "WARNING_UNSPECIFIED": 0, - "RESOURCE_NOT_ACTIVE": 1, - "RESOURCE_BEING_MODIFIED": 2 - } - } - } - } - } - }, - "ListPolicyBasedRoutesRequest": { - "fields": { - "parent": { - "type": "string", - "id": 1, - "options": { - "(google.api.field_behavior)": "REQUIRED", - "(google.api.resource_reference).type": "locations.googleapis.com/Location" - } - }, - "pageSize": { - "type": "int32", - "id": 2 - }, - "pageToken": { - "type": "string", - "id": 3 - }, - "filter": { - "type": "string", - "id": 4 - }, - "orderBy": { - "type": "string", - "id": 5 - } - } - }, - "ListPolicyBasedRoutesResponse": { - "fields": { - "policyBasedRoutes": { - "rule": "repeated", - "type": "PolicyBasedRoute", - "id": 1 - }, - "nextPageToken": { - "type": "string", - "id": 2 - }, - "unreachable": { - "rule": "repeated", - "type": "string", - "id": 3 - } - } - }, - "GetPolicyBasedRouteRequest": { - "fields": { - "name": { - "type": "string", - "id": 1, - "options": { - "(google.api.field_behavior)": "REQUIRED", - "(google.api.resource_reference).type": "networkconnectivity.googleapis.com/PolicyBasedRoute" - } - } - } - }, - "CreatePolicyBasedRouteRequest": { - "fields": { - "parent": { - "type": "string", - "id": 1, - "options": { - "(google.api.field_behavior)": "REQUIRED", - "(google.api.resource_reference).type": "locations.googleapis.com/Location" - } - }, - "policyBasedRouteId": { - "type": "string", - "id": 2, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - }, - "policyBasedRoute": { - "type": "PolicyBasedRoute", - "id": 3, - "options": { - "(google.api.field_behavior)": "REQUIRED" - } - }, - "requestId": { - "type": "string", - "id": 4, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - } - } - }, - "DeletePolicyBasedRouteRequest": { - "fields": { - "name": { - "type": "string", - "id": 1, - "options": { - "(google.api.field_behavior)": "REQUIRED", - "(google.api.resource_reference).type": "networkconnectivity.googleapis.com/PolicyBasedRoute" - } - }, - "requestId": { - "type": "string", - "id": 2, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - } - } } } }, @@ -2020,7 +1568,7 @@ "options": { "go_package": "google.golang.org/genproto/googleapis/api/annotations;annotations", "java_multiple_files": true, - "java_outer_classname": "ClientProto", + "java_outer_classname": "ResourceProto", "java_package": "com.google.api", "objc_class_prefix": "GAPI", "cc_enable_arenas": true @@ -2044,83 +1592,6 @@ "NON_EMPTY_DEFAULT": 7 } }, - "resourceReference": { - "type": "google.api.ResourceReference", - "id": 1055, - "extend": "google.protobuf.FieldOptions" - }, - "resourceDefinition": { - "rule": "repeated", - "type": "google.api.ResourceDescriptor", - "id": 1053, - "extend": "google.protobuf.FileOptions" - }, - "resource": { - "type": "google.api.ResourceDescriptor", - "id": 1053, - "extend": "google.protobuf.MessageOptions" - }, - "ResourceDescriptor": { - "fields": { - "type": { - "type": "string", - "id": 1 - }, - "pattern": { - "rule": "repeated", - "type": "string", - "id": 2 - }, - "nameField": { - "type": "string", - "id": 3 - }, - "history": { - "type": "History", - "id": 4 - }, - "plural": { - "type": "string", - "id": 5 - }, - "singular": { - "type": "string", - "id": 6 - }, - "style": { - "rule": "repeated", - "type": "Style", - "id": 10 - } - }, - "nested": { - "History": { - "values": { - "HISTORY_UNSPECIFIED": 0, - "ORIGINALLY_SINGLE_PATTERN": 1, - "FUTURE_MULTI_PATTERN": 2 - } - }, - "Style": { - "values": { - "STYLE_UNSPECIFIED": 0, - "DECLARATIVE_FRIENDLY": 1 - } - } - } - }, - "ResourceReference": { - "fields": { - "type": { - "type": "string", - "id": 1 - }, - "childType": { - "type": "string", - "id": 2 - } - } - }, "http": { "type": "HttpRule", "id": 72295728, @@ -2223,6 +1694,83 @@ "type": "string", "id": 1050, "extend": "google.protobuf.ServiceOptions" + }, + "resourceReference": { + "type": "google.api.ResourceReference", + "id": 1055, + "extend": "google.protobuf.FieldOptions" + }, + "resourceDefinition": { + "rule": "repeated", + "type": "google.api.ResourceDescriptor", + "id": 1053, + "extend": "google.protobuf.FileOptions" + }, + "resource": { + "type": "google.api.ResourceDescriptor", + "id": 1053, + "extend": "google.protobuf.MessageOptions" + }, + "ResourceDescriptor": { + "fields": { + "type": { + "type": "string", + "id": 1 + }, + "pattern": { + "rule": "repeated", + "type": "string", + "id": 2 + }, + "nameField": { + "type": "string", + "id": 3 + }, + "history": { + "type": "History", + "id": 4 + }, + "plural": { + "type": "string", + "id": 5 + }, + "singular": { + "type": "string", + "id": 6 + }, + "style": { + "rule": "repeated", + "type": "Style", + "id": 10 + } + }, + "nested": { + "History": { + "values": { + "HISTORY_UNSPECIFIED": 0, + "ORIGINALLY_SINGLE_PATTERN": 1, + "FUTURE_MULTI_PATTERN": 2 + } + }, + "Style": { + "values": { + "STYLE_UNSPECIFIED": 0, + "DECLARATIVE_FRIENDLY": 1 + } + } + } + }, + "ResourceReference": { + "fields": { + "type": { + "type": "string", + "id": 1 + }, + "childType": { + "type": "string", + "id": 2 + } + } } } }, diff --git a/packages/google-cloud-networkconnectivity/samples/generated/v1/hub_service.create_hub.js b/packages/google-cloud-networkconnectivity/samples/generated/v1/hub_service.create_hub.js index 5386f809b62..0befc0b31ab 100644 --- a/packages/google-cloud-networkconnectivity/samples/generated/v1/hub_service.create_hub.js +++ b/packages/google-cloud-networkconnectivity/samples/generated/v1/hub_service.create_hub.js @@ -41,11 +41,11 @@ function main(parent, hubId, hub) { */ // const hub = {} /** - * Optional. A unique request ID (optional). If you specify this ID, you can - * use it in cases when you need to retry your request. When you need to - * retry, this ID lets the server know that it can ignore the request if it - * has already been completed. The server guarantees that for at least 60 - * minutes after the first request. + * Optional. A unique request ID (optional). If you specify this ID, you can use it + * in cases when you need to retry your request. When you need to retry, this + * ID lets the server know that it can ignore the request if it has already + * been completed. The server guarantees that for at least 60 minutes after + * the first request. * For example, consider a situation where you make an initial request and * the request times out. If you make the request again with the same request * ID, the server can check to see whether the original operation diff --git a/packages/google-cloud-networkconnectivity/samples/generated/v1/hub_service.create_spoke.js b/packages/google-cloud-networkconnectivity/samples/generated/v1/hub_service.create_spoke.js index 8838c551a7d..73affb0f325 100644 --- a/packages/google-cloud-networkconnectivity/samples/generated/v1/hub_service.create_spoke.js +++ b/packages/google-cloud-networkconnectivity/samples/generated/v1/hub_service.create_spoke.js @@ -41,11 +41,11 @@ function main(parent, spokeId, spoke) { */ // const spoke = {} /** - * Optional. A unique request ID (optional). If you specify this ID, you can - * use it in cases when you need to retry your request. When you need to - * retry, this ID lets the server know that it can ignore the request if it - * has already been completed. The server guarantees that for at least 60 - * minutes after the first request. + * Optional. A unique request ID (optional). If you specify this ID, you can use it + * in cases when you need to retry your request. When you need to retry, this + * ID lets the server know that it can ignore the request if it has already + * been completed. The server guarantees that for at least 60 minutes after + * the first request. * For example, consider a situation where you make an initial request and * the request times out. If you make the request again with the same request * ID, the server can check to see whether the original operation diff --git a/packages/google-cloud-networkconnectivity/samples/generated/v1/hub_service.delete_hub.js b/packages/google-cloud-networkconnectivity/samples/generated/v1/hub_service.delete_hub.js index 380e2478bb1..cae2bbd9aa0 100644 --- a/packages/google-cloud-networkconnectivity/samples/generated/v1/hub_service.delete_hub.js +++ b/packages/google-cloud-networkconnectivity/samples/generated/v1/hub_service.delete_hub.js @@ -33,11 +33,11 @@ function main(name) { */ // const name = 'abc123' /** - * Optional. A unique request ID (optional). If you specify this ID, you can - * use it in cases when you need to retry your request. When you need to - * retry, this ID lets the server know that it can ignore the request if it - * has already been completed. The server guarantees that for at least 60 - * minutes after the first request. + * Optional. A unique request ID (optional). If you specify this ID, you can use it + * in cases when you need to retry your request. When you need to retry, this + * ID lets the server know that it can ignore the request if it has already + * been completed. The server guarantees that for at least 60 minutes after + * the first request. * For example, consider a situation where you make an initial request and * the request times out. If you make the request again with the same request * ID, the server can check to see whether the original operation diff --git a/packages/google-cloud-networkconnectivity/samples/generated/v1/hub_service.delete_spoke.js b/packages/google-cloud-networkconnectivity/samples/generated/v1/hub_service.delete_spoke.js index 290cda0f1c6..81d00dbfaec 100644 --- a/packages/google-cloud-networkconnectivity/samples/generated/v1/hub_service.delete_spoke.js +++ b/packages/google-cloud-networkconnectivity/samples/generated/v1/hub_service.delete_spoke.js @@ -33,11 +33,11 @@ function main(name) { */ // const name = 'abc123' /** - * Optional. A unique request ID (optional). If you specify this ID, you can - * use it in cases when you need to retry your request. When you need to - * retry, this ID lets the server know that it can ignore the request if it - * has already been completed. The server guarantees that for at least 60 - * minutes after the first request. + * Optional. A unique request ID (optional). If you specify this ID, you can use it + * in cases when you need to retry your request. When you need to retry, this + * ID lets the server know that it can ignore the request if it has already + * been completed. The server guarantees that for at least 60 minutes after + * the first request. * For example, consider a situation where you make an initial request and * the request times out. If you make the request again with the same request * ID, the server can check to see whether the original operation diff --git a/packages/google-cloud-networkconnectivity/samples/generated/v1/hub_service.update_hub.js b/packages/google-cloud-networkconnectivity/samples/generated/v1/hub_service.update_hub.js index 9f5b0dbbed6..63d3d1835e2 100644 --- a/packages/google-cloud-networkconnectivity/samples/generated/v1/hub_service.update_hub.js +++ b/packages/google-cloud-networkconnectivity/samples/generated/v1/hub_service.update_hub.js @@ -29,11 +29,11 @@ function main(hub) { * TODO(developer): Uncomment these variables before running the sample. */ /** - * Optional. In the case of an update to an existing hub, field mask is used - * to specify the fields to be overwritten. The fields specified in the - * update_mask are relative to the resource, not the full request. A field is - * overwritten if it is in the mask. If the user does not provide a mask, then - * all fields are overwritten. + * Optional. In the case of an update to an existing hub, field mask is used to specify + * the fields to be overwritten. The fields specified in the update_mask are + * relative to the resource, not the full request. A field is overwritten if + * it is in the mask. If the user does not provide a mask, then all fields are + * overwritten. */ // const updateMask = {} /** @@ -41,11 +41,11 @@ function main(hub) { */ // const hub = {} /** - * Optional. A unique request ID (optional). If you specify this ID, you can - * use it in cases when you need to retry your request. When you need to - * retry, this ID lets the server know that it can ignore the request if it - * has already been completed. The server guarantees that for at least 60 - * minutes after the first request. + * Optional. A unique request ID (optional). If you specify this ID, you can use it + * in cases when you need to retry your request. When you need to retry, this + * ID lets the server know that it can ignore the request if it has already + * been completed. The server guarantees that for at least 60 minutes after + * the first request. * For example, consider a situation where you make an initial request and * the request times out. If you make the request again with the same request * ID, the server can check to see whether the original operation diff --git a/packages/google-cloud-networkconnectivity/samples/generated/v1/hub_service.update_spoke.js b/packages/google-cloud-networkconnectivity/samples/generated/v1/hub_service.update_spoke.js index af05ba517c3..f33321f04eb 100644 --- a/packages/google-cloud-networkconnectivity/samples/generated/v1/hub_service.update_spoke.js +++ b/packages/google-cloud-networkconnectivity/samples/generated/v1/hub_service.update_spoke.js @@ -29,8 +29,8 @@ function main(spoke) { * TODO(developer): Uncomment these variables before running the sample. */ /** - * Optional. In the case of an update to an existing spoke, field mask is used - * to specify the fields to be overwritten. The fields specified in the + * Optional. In the case of an update to an existing spoke, field mask is used to + * specify the fields to be overwritten. The fields specified in the * update_mask are relative to the resource, not the full request. A field is * overwritten if it is in the mask. If the user does not provide a mask, then * all fields are overwritten. @@ -41,11 +41,11 @@ function main(spoke) { */ // const spoke = {} /** - * Optional. A unique request ID (optional). If you specify this ID, you can - * use it in cases when you need to retry your request. When you need to - * retry, this ID lets the server know that it can ignore the request if it - * has already been completed. The server guarantees that for at least 60 - * minutes after the first request. + * Optional. A unique request ID (optional). If you specify this ID, you can use it + * in cases when you need to retry your request. When you need to retry, this + * ID lets the server know that it can ignore the request if it has already + * been completed. The server guarantees that for at least 60 minutes after + * the first request. * For example, consider a situation where you make an initial request and * the request times out. If you make the request again with the same request * ID, the server can check to see whether the original operation diff --git a/packages/google-cloud-networkconnectivity/samples/generated/v1/snippet_metadata.google.cloud.networkconnectivity.v1.json b/packages/google-cloud-networkconnectivity/samples/generated/v1/snippet_metadata.google.cloud.networkconnectivity.v1.json index 802d196570e..a3aa657f525 100644 --- a/packages/google-cloud-networkconnectivity/samples/generated/v1/snippet_metadata.google.cloud.networkconnectivity.v1.json +++ b/packages/google-cloud-networkconnectivity/samples/generated/v1/snippet_metadata.google.cloud.networkconnectivity.v1.json @@ -15,7 +15,7 @@ "regionTag": "networkconnectivity_v1_generated_HubService_ListHubs_async", "title": "HubService listHubs Sample", "origin": "API_DEFINITION", - "description": " Lists the Network Connectivity Center hubs associated with a given project.", + "description": " Lists hubs in a given project.", "canonical": true, "file": "hub_service.list_hubs.js", "language": "JAVASCRIPT", @@ -71,7 +71,7 @@ "regionTag": "networkconnectivity_v1_generated_HubService_GetHub_async", "title": "HubService getHub Sample", "origin": "API_DEFINITION", - "description": " Gets details about a Network Connectivity Center hub.", + "description": " Gets details about the specified hub.", "canonical": true, "file": "hub_service.get_hub.js", "language": "JAVASCRIPT", @@ -111,7 +111,7 @@ "regionTag": "networkconnectivity_v1_generated_HubService_CreateHub_async", "title": "HubService createHub Sample", "origin": "API_DEFINITION", - "description": " Creates a new Network Connectivity Center hub in the specified project.", + "description": " Creates a new hub in the specified project.", "canonical": true, "file": "hub_service.create_hub.js", "language": "JAVASCRIPT", @@ -163,7 +163,7 @@ "regionTag": "networkconnectivity_v1_generated_HubService_UpdateHub_async", "title": "HubService updateHub Sample", "origin": "API_DEFINITION", - "description": " Updates the description and/or labels of a Network Connectivity Center hub.", + "description": " Updates the description and/or labels of the specified hub.", "canonical": true, "file": "hub_service.update_hub.js", "language": "JAVASCRIPT", @@ -211,7 +211,7 @@ "regionTag": "networkconnectivity_v1_generated_HubService_DeleteHub_async", "title": "HubService deleteHub Sample", "origin": "API_DEFINITION", - "description": " Deletes a Network Connectivity Center hub.", + "description": " Deletes the specified hub.", "canonical": true, "file": "hub_service.delete_hub.js", "language": "JAVASCRIPT", @@ -255,7 +255,7 @@ "regionTag": "networkconnectivity_v1_generated_HubService_ListSpokes_async", "title": "HubService listSpokes Sample", "origin": "API_DEFINITION", - "description": " Lists the Network Connectivity Center spokes in a specified project and location.", + "description": " Lists the spokes in the specified project and location.", "canonical": true, "file": "hub_service.list_spokes.js", "language": "JAVASCRIPT", @@ -311,7 +311,7 @@ "regionTag": "networkconnectivity_v1_generated_HubService_GetSpoke_async", "title": "HubService getSpoke Sample", "origin": "API_DEFINITION", - "description": " Gets details about a Network Connectivity Center spoke.", + "description": " Gets details about the specified spoke.", "canonical": true, "file": "hub_service.get_spoke.js", "language": "JAVASCRIPT", @@ -351,7 +351,7 @@ "regionTag": "networkconnectivity_v1_generated_HubService_CreateSpoke_async", "title": "HubService createSpoke Sample", "origin": "API_DEFINITION", - "description": " Creates a Network Connectivity Center spoke.", + "description": " Creates a spoke in the specified project and location.", "canonical": true, "file": "hub_service.create_spoke.js", "language": "JAVASCRIPT", @@ -403,7 +403,7 @@ "regionTag": "networkconnectivity_v1_generated_HubService_UpdateSpoke_async", "title": "HubService updateSpoke Sample", "origin": "API_DEFINITION", - "description": " Updates the parameters of a Network Connectivity Center spoke.", + "description": " Updates the parameters of the specified spoke.", "canonical": true, "file": "hub_service.update_spoke.js", "language": "JAVASCRIPT", @@ -451,7 +451,7 @@ "regionTag": "networkconnectivity_v1_generated_HubService_DeleteSpoke_async", "title": "HubService deleteSpoke Sample", "origin": "API_DEFINITION", - "description": " Deletes a Network Connectivity Center spoke.", + "description": " Deletes the specified spoke.", "canonical": true, "file": "hub_service.delete_spoke.js", "language": "JAVASCRIPT", @@ -490,198 +490,6 @@ } } } - }, - { - "regionTag": "networkconnectivity_v1_generated_PolicyBasedRoutingService_ListPolicyBasedRoutes_async", - "title": "HubService listPolicyBasedRoutes Sample", - "origin": "API_DEFINITION", - "description": " Lists PolicyBasedRoutes in a given project and location.", - "canonical": true, - "file": "policy_based_routing_service.list_policy_based_routes.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 71, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListPolicyBasedRoutes", - "fullName": "google.cloud.networkconnectivity.v1.PolicyBasedRoutingService.ListPolicyBasedRoutes", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - }, - { - "name": "filter", - "type": "TYPE_STRING" - }, - { - "name": "order_by", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.networkconnectivity.v1.ListPolicyBasedRoutesResponse", - "client": { - "shortName": "PolicyBasedRoutingServiceClient", - "fullName": "google.cloud.networkconnectivity.v1.PolicyBasedRoutingServiceClient" - }, - "method": { - "shortName": "ListPolicyBasedRoutes", - "fullName": "google.cloud.networkconnectivity.v1.PolicyBasedRoutingService.ListPolicyBasedRoutes", - "service": { - "shortName": "PolicyBasedRoutingService", - "fullName": "google.cloud.networkconnectivity.v1.PolicyBasedRoutingService" - } - } - } - }, - { - "regionTag": "networkconnectivity_v1_generated_PolicyBasedRoutingService_GetPolicyBasedRoute_async", - "title": "HubService getPolicyBasedRoute Sample", - "origin": "API_DEFINITION", - "description": " Gets details of a single PolicyBasedRoute.", - "canonical": true, - "file": "policy_based_routing_service.get_policy_based_route.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 53, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetPolicyBasedRoute", - "fullName": "google.cloud.networkconnectivity.v1.PolicyBasedRoutingService.GetPolicyBasedRoute", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.networkconnectivity.v1.PolicyBasedRoute", - "client": { - "shortName": "PolicyBasedRoutingServiceClient", - "fullName": "google.cloud.networkconnectivity.v1.PolicyBasedRoutingServiceClient" - }, - "method": { - "shortName": "GetPolicyBasedRoute", - "fullName": "google.cloud.networkconnectivity.v1.PolicyBasedRoutingService.GetPolicyBasedRoute", - "service": { - "shortName": "PolicyBasedRoutingService", - "fullName": "google.cloud.networkconnectivity.v1.PolicyBasedRoutingService" - } - } - } - }, - { - "regionTag": "networkconnectivity_v1_generated_PolicyBasedRoutingService_CreatePolicyBasedRoute_async", - "title": "HubService createPolicyBasedRoute Sample", - "origin": "API_DEFINITION", - "description": " Creates a new PolicyBasedRoute in a given project and location.", - "canonical": true, - "file": "policy_based_routing_service.create_policy_based_route.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 77, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreatePolicyBasedRoute", - "fullName": "google.cloud.networkconnectivity.v1.PolicyBasedRoutingService.CreatePolicyBasedRoute", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "policy_based_route_id", - "type": "TYPE_STRING" - }, - { - "name": "policy_based_route", - "type": ".google.cloud.networkconnectivity.v1.PolicyBasedRoute" - }, - { - "name": "request_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "PolicyBasedRoutingServiceClient", - "fullName": "google.cloud.networkconnectivity.v1.PolicyBasedRoutingServiceClient" - }, - "method": { - "shortName": "CreatePolicyBasedRoute", - "fullName": "google.cloud.networkconnectivity.v1.PolicyBasedRoutingService.CreatePolicyBasedRoute", - "service": { - "shortName": "PolicyBasedRoutingService", - "fullName": "google.cloud.networkconnectivity.v1.PolicyBasedRoutingService" - } - } - } - }, - { - "regionTag": "networkconnectivity_v1_generated_PolicyBasedRoutingService_DeletePolicyBasedRoute_async", - "title": "HubService deletePolicyBasedRoute Sample", - "origin": "API_DEFINITION", - "description": " Deletes a single PolicyBasedRoute.", - "canonical": true, - "file": "policy_based_routing_service.delete_policy_based_route.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 68, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeletePolicyBasedRoute", - "fullName": "google.cloud.networkconnectivity.v1.PolicyBasedRoutingService.DeletePolicyBasedRoute", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "request_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "PolicyBasedRoutingServiceClient", - "fullName": "google.cloud.networkconnectivity.v1.PolicyBasedRoutingServiceClient" - }, - "method": { - "shortName": "DeletePolicyBasedRoute", - "fullName": "google.cloud.networkconnectivity.v1.PolicyBasedRoutingService.DeletePolicyBasedRoute", - "service": { - "shortName": "PolicyBasedRoutingService", - "fullName": "google.cloud.networkconnectivity.v1.PolicyBasedRoutingService" - } - } - } } ] } \ No newline at end of file diff --git a/packages/google-cloud-networkconnectivity/src/index.ts b/packages/google-cloud-networkconnectivity/src/index.ts index d27aa0cb93d..993391871ee 100644 --- a/packages/google-cloud-networkconnectivity/src/index.ts +++ b/packages/google-cloud-networkconnectivity/src/index.ts @@ -21,15 +21,8 @@ import * as v1alpha1 from './v1alpha1'; const HubServiceClient = v1.HubServiceClient; type HubServiceClient = v1.HubServiceClient; -const PolicyBasedRoutingServiceClient = v1.PolicyBasedRoutingServiceClient; -type PolicyBasedRoutingServiceClient = v1.PolicyBasedRoutingServiceClient; -export {v1, v1alpha1, HubServiceClient, PolicyBasedRoutingServiceClient}; -export default { - v1, - v1alpha1, - HubServiceClient, - PolicyBasedRoutingServiceClient, -}; +export {v1, v1alpha1, HubServiceClient}; +export default {v1, v1alpha1, HubServiceClient}; import * as protos from '../protos/protos'; export {protos}; diff --git a/packages/google-cloud-networkconnectivity/src/v1/gapic_metadata.json b/packages/google-cloud-networkconnectivity/src/v1/gapic_metadata.json index f327f4e8b54..3e4f0fedf40 100644 --- a/packages/google-cloud-networkconnectivity/src/v1/gapic_metadata.json +++ b/packages/google-cloud-networkconnectivity/src/v1/gapic_metadata.json @@ -126,64 +126,6 @@ } } } - }, - "PolicyBasedRoutingService": { - "clients": { - "grpc": { - "libraryClient": "PolicyBasedRoutingServiceClient", - "rpcs": { - "GetPolicyBasedRoute": { - "methods": [ - "getPolicyBasedRoute" - ] - }, - "CreatePolicyBasedRoute": { - "methods": [ - "createPolicyBasedRoute" - ] - }, - "DeletePolicyBasedRoute": { - "methods": [ - "deletePolicyBasedRoute" - ] - }, - "ListPolicyBasedRoutes": { - "methods": [ - "listPolicyBasedRoutes", - "listPolicyBasedRoutesStream", - "listPolicyBasedRoutesAsync" - ] - } - } - }, - "grpc-fallback": { - "libraryClient": "PolicyBasedRoutingServiceClient", - "rpcs": { - "GetPolicyBasedRoute": { - "methods": [ - "getPolicyBasedRoute" - ] - }, - "CreatePolicyBasedRoute": { - "methods": [ - "createPolicyBasedRoute" - ] - }, - "DeletePolicyBasedRoute": { - "methods": [ - "deletePolicyBasedRoute" - ] - }, - "ListPolicyBasedRoutes": { - "methods": [ - "listPolicyBasedRoutes", - "listPolicyBasedRoutesStream", - "listPolicyBasedRoutesAsync" - ] - } - } - } - } } } } diff --git a/packages/google-cloud-networkconnectivity/src/v1/hub_service_client.ts b/packages/google-cloud-networkconnectivity/src/v1/hub_service_client.ts index f4a9bcea44b..bc2a9107349 100644 --- a/packages/google-cloud-networkconnectivity/src/v1/hub_service_client.ts +++ b/packages/google-cloud-networkconnectivity/src/v1/hub_service_client.ts @@ -27,10 +27,6 @@ import type { LROperation, PaginationCallback, GaxCall, - IamClient, - IamProtos, - LocationsClient, - LocationProtos, } from 'google-gax'; import {Transform} from 'stream'; import * as protos from '../../protos/protos'; @@ -67,8 +63,6 @@ export class HubServiceClient { }; warn: (code: string, message: string, warnType?: string) => void; innerApiCalls: {[name: string]: Function}; - iamClient: IamClient; - locationsClient: LocationsClient; pathTemplates: {[name: string]: gax.PathTemplate}; operationsClient: gax.OperationsClient; hubServiceStub?: Promise<{[name: string]: Function}>; @@ -166,12 +160,6 @@ export class HubServiceClient { if (servicePath === staticMembers.servicePath) { this.auth.defaultScopes = staticMembers.scopes; } - this.iamClient = new this._gaxModule.IamClient(this._gaxGrpc, opts); - - this.locationsClient = new this._gaxModule.LocationsClient( - this._gaxGrpc, - opts - ); // Determine the client header string. const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; @@ -210,9 +198,6 @@ export class HubServiceClient { networkPathTemplate: new this._gaxModule.PathTemplate( 'projects/{project}/global/networks/{resource_id}' ), - policyBasedRoutePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/{location}/global/PolicyBasedRoutes/{policy_based_route}' - ), spokePathTemplate: new this._gaxModule.PathTemplate( 'projects/{project}/locations/{location}/spokes/{spoke}' ), @@ -266,15 +251,6 @@ export class HubServiceClient { { get: '/v1/{resource=projects/*/locations/global/policyBasedRoutes/*}:getIamPolicy', }, - { - get: '/v1/{resource=projects/*/locations/*/serviceConnectionMaps/*}:getIamPolicy', - }, - { - get: '/v1/{resource=projects/*/locations/*/serviceConnectionPolicies/*}:getIamPolicy', - }, - { - get: '/v1/{resource=projects/*/locations/*/serviceClasses/*}:getIamPolicy', - }, ], }, { @@ -290,18 +266,6 @@ export class HubServiceClient { post: '/v1/{resource=projects/*/locations/global/policyBasedRoutes/*}:setIamPolicy', body: '*', }, - { - post: '/v1/{resource=projects/*/locations/*/serviceConnectionMaps/*}:setIamPolicy', - body: '*', - }, - { - post: '/v1/{resource=projects/*/locations/*/serviceConnectionPolicies/*}:setIamPolicy', - body: '*', - }, - { - post: '/v1/{resource=projects/*/locations/*/serviceClasses/*}:setIamPolicy', - body: '*', - }, ], }, { @@ -317,18 +281,6 @@ export class HubServiceClient { post: '/v1/{resource=projects/*/locations/global/policyBasedRoutes/*}:testIamPermissions', body: '*', }, - { - post: '/v1/{resource=projects/*/locations/*/serviceConnectionMaps/*}:testIamPermissions', - body: '*', - }, - { - post: '/v1/{resource=projects/*/locations/*/serviceConnectionPolicies/*}:testIamPermissions', - body: '*', - }, - { - post: '/v1/{resource=projects/*/locations/*/serviceClasses/*}:testIamPermissions', - body: '*', - }, ], }, { @@ -570,7 +522,7 @@ export class HubServiceClient { // -- Service calls -- // ------------------- /** - * Gets details about a Network Connectivity Center hub. + * Gets details about the specified hub. * * @param {Object} request * The request object that will be sent. @@ -661,7 +613,7 @@ export class HubServiceClient { return this.innerApiCalls.getHub(request, options, callback); } /** - * Gets details about a Network Connectivity Center spoke. + * Gets details about the specified spoke. * * @param {Object} request * The request object that will be sent. @@ -753,7 +705,7 @@ export class HubServiceClient { } /** - * Creates a new Network Connectivity Center hub in the specified project. + * Creates a new hub in the specified project. * * @param {Object} request * The request object that will be sent. @@ -764,11 +716,11 @@ export class HubServiceClient { * @param {google.cloud.networkconnectivity.v1.Hub} request.hub * Required. The initial values for a new hub. * @param {string} [request.requestId] - * Optional. A unique request ID (optional). If you specify this ID, you can - * use it in cases when you need to retry your request. When you need to - * retry, this ID lets the server know that it can ignore the request if it - * has already been completed. The server guarantees that for at least 60 - * minutes after the first request. + * Optional. A unique request ID (optional). If you specify this ID, you can use it + * in cases when you need to retry your request. When you need to retry, this + * ID lets the server know that it can ignore the request if it has already + * been completed. The server guarantees that for at least 60 minutes after + * the first request. * * For example, consider a situation where you make an initial request and * the request times out. If you make the request again with the same request @@ -910,25 +862,24 @@ export class HubServiceClient { >; } /** - * Updates the description and/or labels of a Network Connectivity Center - * hub. + * Updates the description and/or labels of the specified hub. * * @param {Object} request * The request object that will be sent. * @param {google.protobuf.FieldMask} [request.updateMask] - * Optional. In the case of an update to an existing hub, field mask is used - * to specify the fields to be overwritten. The fields specified in the - * update_mask are relative to the resource, not the full request. A field is - * overwritten if it is in the mask. If the user does not provide a mask, then - * all fields are overwritten. + * Optional. In the case of an update to an existing hub, field mask is used to specify + * the fields to be overwritten. The fields specified in the update_mask are + * relative to the resource, not the full request. A field is overwritten if + * it is in the mask. If the user does not provide a mask, then all fields are + * overwritten. * @param {google.cloud.networkconnectivity.v1.Hub} request.hub * Required. The state that the hub should be in after the update. * @param {string} [request.requestId] - * Optional. A unique request ID (optional). If you specify this ID, you can - * use it in cases when you need to retry your request. When you need to - * retry, this ID lets the server know that it can ignore the request if it - * has already been completed. The server guarantees that for at least 60 - * minutes after the first request. + * Optional. A unique request ID (optional). If you specify this ID, you can use it + * in cases when you need to retry your request. When you need to retry, this + * ID lets the server know that it can ignore the request if it has already + * been completed. The server guarantees that for at least 60 minutes after + * the first request. * * For example, consider a situation where you make an initial request and * the request times out. If you make the request again with the same request @@ -1070,18 +1021,18 @@ export class HubServiceClient { >; } /** - * Deletes a Network Connectivity Center hub. + * Deletes the specified hub. * * @param {Object} request * The request object that will be sent. * @param {string} request.name * Required. The name of the hub to delete. * @param {string} [request.requestId] - * Optional. A unique request ID (optional). If you specify this ID, you can - * use it in cases when you need to retry your request. When you need to - * retry, this ID lets the server know that it can ignore the request if it - * has already been completed. The server guarantees that for at least 60 - * minutes after the first request. + * Optional. A unique request ID (optional). If you specify this ID, you can use it + * in cases when you need to retry your request. When you need to retry, this + * ID lets the server know that it can ignore the request if it has already + * been completed. The server guarantees that for at least 60 minutes after + * the first request. * * For example, consider a situation where you make an initial request and * the request times out. If you make the request again with the same request @@ -1223,7 +1174,7 @@ export class HubServiceClient { >; } /** - * Creates a Network Connectivity Center spoke. + * Creates a spoke in the specified project and location. * * @param {Object} request * The request object that will be sent. @@ -1234,11 +1185,11 @@ export class HubServiceClient { * @param {google.cloud.networkconnectivity.v1.Spoke} request.spoke * Required. The initial values for a new spoke. * @param {string} [request.requestId] - * Optional. A unique request ID (optional). If you specify this ID, you can - * use it in cases when you need to retry your request. When you need to - * retry, this ID lets the server know that it can ignore the request if it - * has already been completed. The server guarantees that for at least 60 - * minutes after the first request. + * Optional. A unique request ID (optional). If you specify this ID, you can use it + * in cases when you need to retry your request. When you need to retry, this + * ID lets the server know that it can ignore the request if it has already + * been completed. The server guarantees that for at least 60 minutes after + * the first request. * * For example, consider a situation where you make an initial request and * the request times out. If you make the request again with the same request @@ -1380,24 +1331,24 @@ export class HubServiceClient { >; } /** - * Updates the parameters of a Network Connectivity Center spoke. + * Updates the parameters of the specified spoke. * * @param {Object} request * The request object that will be sent. * @param {google.protobuf.FieldMask} [request.updateMask] - * Optional. In the case of an update to an existing spoke, field mask is used - * to specify the fields to be overwritten. The fields specified in the + * Optional. In the case of an update to an existing spoke, field mask is used to + * specify the fields to be overwritten. The fields specified in the * update_mask are relative to the resource, not the full request. A field is * overwritten if it is in the mask. If the user does not provide a mask, then * all fields are overwritten. * @param {google.cloud.networkconnectivity.v1.Spoke} request.spoke * Required. The state that the spoke should be in after the update. * @param {string} [request.requestId] - * Optional. A unique request ID (optional). If you specify this ID, you can - * use it in cases when you need to retry your request. When you need to - * retry, this ID lets the server know that it can ignore the request if it - * has already been completed. The server guarantees that for at least 60 - * minutes after the first request. + * Optional. A unique request ID (optional). If you specify this ID, you can use it + * in cases when you need to retry your request. When you need to retry, this + * ID lets the server know that it can ignore the request if it has already + * been completed. The server guarantees that for at least 60 minutes after + * the first request. * * For example, consider a situation where you make an initial request and * the request times out. If you make the request again with the same request @@ -1539,18 +1490,18 @@ export class HubServiceClient { >; } /** - * Deletes a Network Connectivity Center spoke. + * Deletes the specified spoke. * * @param {Object} request * The request object that will be sent. * @param {string} request.name * Required. The name of the spoke to delete. * @param {string} [request.requestId] - * Optional. A unique request ID (optional). If you specify this ID, you can - * use it in cases when you need to retry your request. When you need to - * retry, this ID lets the server know that it can ignore the request if it - * has already been completed. The server guarantees that for at least 60 - * minutes after the first request. + * Optional. A unique request ID (optional). If you specify this ID, you can use it + * in cases when you need to retry your request. When you need to retry, this + * ID lets the server know that it can ignore the request if it has already + * been completed. The server guarantees that for at least 60 minutes after + * the first request. * * For example, consider a situation where you make an initial request and * the request times out. If you make the request again with the same request @@ -1692,7 +1643,7 @@ export class HubServiceClient { >; } /** - * Lists the Network Connectivity Center hubs associated with a given project. + * Lists hubs in a given project. * * @param {Object} request * The request object that will be sent. @@ -1893,8 +1844,7 @@ export class HubServiceClient { ) as AsyncIterable; } /** - * Lists the Network Connectivity Center spokes in a specified project and - * location. + * Lists the spokes in the specified project and location. * * @param {Object} request * The request object that will be sent. @@ -2094,403 +2044,6 @@ export class HubServiceClient { callSettings ) as AsyncIterable; } - /** - * Gets the access control policy for a resource. Returns an empty policy - * if the resource exists and does not have a policy set. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.resource - * REQUIRED: The resource for which the policy is being requested. - * See the operation documentation for the appropriate value for this field. - * @param {Object} [request.options] - * OPTIONAL: A `GetPolicyOptions` object for specifying options to - * `GetIamPolicy`. This field is only used by Cloud IAM. - * - * This object should have the same structure as [GetPolicyOptions]{@link google.iam.v1.GetPolicyOptions} - * @param {Object} [options] - * Optional parameters. You can override the default settings for this call, e.g, timeout, - * retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html} for the details. - * @param {function(?Error, ?Object)} [callback] - * The function which will be called with the result of the API call. - * - * The second parameter to the callback is an object representing [Policy]{@link google.iam.v1.Policy}. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [Policy]{@link google.iam.v1.Policy}. - * The promise has a method named "cancel" which cancels the ongoing API call. - */ - getIamPolicy( - request: IamProtos.google.iam.v1.GetIamPolicyRequest, - options?: - | gax.CallOptions - | Callback< - IamProtos.google.iam.v1.Policy, - IamProtos.google.iam.v1.GetIamPolicyRequest | null | undefined, - {} | null | undefined - >, - callback?: Callback< - IamProtos.google.iam.v1.Policy, - IamProtos.google.iam.v1.GetIamPolicyRequest | null | undefined, - {} | null | undefined - > - ): Promise { - return this.iamClient.getIamPolicy(request, options, callback); - } - - /** - * Returns permissions that a caller has on the specified resource. If the - * resource does not exist, this will return an empty set of - * permissions, not a NOT_FOUND error. - * - * Note: This operation is designed to be used for building - * permission-aware UIs and command-line tools, not for authorization - * checking. This operation may "fail open" without warning. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.resource - * REQUIRED: The resource for which the policy detail is being requested. - * See the operation documentation for the appropriate value for this field. - * @param {string[]} request.permissions - * The set of permissions to check for the `resource`. Permissions with - * wildcards (such as '*' or 'storage.*') are not allowed. For more - * information see - * [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions). - * @param {Object} [options] - * Optional parameters. You can override the default settings for this call, e.g, timeout, - * retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html} for the details. - * @param {function(?Error, ?Object)} [callback] - * The function which will be called with the result of the API call. - * - * The second parameter to the callback is an object representing [TestIamPermissionsResponse]{@link google.iam.v1.TestIamPermissionsResponse}. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [TestIamPermissionsResponse]{@link google.iam.v1.TestIamPermissionsResponse}. - * The promise has a method named "cancel" which cancels the ongoing API call. - */ - setIamPolicy( - request: IamProtos.google.iam.v1.SetIamPolicyRequest, - options?: - | gax.CallOptions - | Callback< - IamProtos.google.iam.v1.Policy, - IamProtos.google.iam.v1.SetIamPolicyRequest | null | undefined, - {} | null | undefined - >, - callback?: Callback< - IamProtos.google.iam.v1.Policy, - IamProtos.google.iam.v1.SetIamPolicyRequest | null | undefined, - {} | null | undefined - > - ): Promise { - return this.iamClient.setIamPolicy(request, options, callback); - } - - /** - * Returns permissions that a caller has on the specified resource. If the - * resource does not exist, this will return an empty set of - * permissions, not a NOT_FOUND error. - * - * Note: This operation is designed to be used for building - * permission-aware UIs and command-line tools, not for authorization - * checking. This operation may "fail open" without warning. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.resource - * REQUIRED: The resource for which the policy detail is being requested. - * See the operation documentation for the appropriate value for this field. - * @param {string[]} request.permissions - * The set of permissions to check for the `resource`. Permissions with - * wildcards (such as '*' or 'storage.*') are not allowed. For more - * information see - * [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions). - * @param {Object} [options] - * Optional parameters. You can override the default settings for this call, e.g, timeout, - * retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html} for the details. - * @param {function(?Error, ?Object)} [callback] - * The function which will be called with the result of the API call. - * - * The second parameter to the callback is an object representing [TestIamPermissionsResponse]{@link google.iam.v1.TestIamPermissionsResponse}. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [TestIamPermissionsResponse]{@link google.iam.v1.TestIamPermissionsResponse}. - * The promise has a method named "cancel" which cancels the ongoing API call. - * - */ - testIamPermissions( - request: IamProtos.google.iam.v1.TestIamPermissionsRequest, - options?: - | gax.CallOptions - | Callback< - IamProtos.google.iam.v1.TestIamPermissionsResponse, - IamProtos.google.iam.v1.TestIamPermissionsRequest | null | undefined, - {} | null | undefined - >, - callback?: Callback< - IamProtos.google.iam.v1.TestIamPermissionsResponse, - IamProtos.google.iam.v1.TestIamPermissionsRequest | null | undefined, - {} | null | undefined - > - ): Promise { - return this.iamClient.testIamPermissions(request, options, callback); - } - - /** - * Gets information about a location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Resource name for the location. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [Location]{@link google.cloud.location.Location}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example - * ``` - * const [response] = await client.getLocation(request); - * ``` - */ - getLocation( - request: LocationProtos.google.cloud.location.IGetLocationRequest, - options?: - | gax.CallOptions - | Callback< - LocationProtos.google.cloud.location.ILocation, - | LocationProtos.google.cloud.location.IGetLocationRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - LocationProtos.google.cloud.location.ILocation, - | LocationProtos.google.cloud.location.IGetLocationRequest - | null - | undefined, - {} | null | undefined - > - ): Promise { - return this.locationsClient.getLocation(request, options, callback); - } - - /** - * Lists information about the supported locations for this service. Returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * The resource that owns the locations collection, if applicable. - * @param {string} request.filter - * The standard list filter. - * @param {number} request.pageSize - * The standard list page size. - * @param {string} request.pageToken - * The standard list page token. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). - * When you iterate the returned iterable, each element will be an object representing - * [Location]{@link google.cloud.location.Location}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - * @example - * ``` - * const iterable = client.listLocationsAsync(request); - * for await (const response of iterable) { - * // process response - * } - * ``` - */ - listLocationsAsync( - request: LocationProtos.google.cloud.location.IListLocationsRequest, - options?: CallOptions - ): AsyncIterable { - return this.locationsClient.listLocationsAsync(request, options); - } - - /** - * Gets the latest state of a long-running operation. Clients can use this - * method to poll the operation result at intervals as recommended by the API - * service. - * - * @param {Object} request - The request object that will be sent. - * @param {string} request.name - The name of the operation resource. - * @param {Object=} options - * Optional parameters. You can override the default settings for this call, - * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link - * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the - * details. - * @param {function(?Error, ?Object)=} callback - * The function which will be called with the result of the API call. - * - * The second parameter to the callback is an object representing - * [google.longrunning.Operation]{@link - * external:"google.longrunning.Operation"}. - * @return {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * [google.longrunning.Operation]{@link - * external:"google.longrunning.Operation"}. The promise has a method named - * "cancel" which cancels the ongoing API call. - * - * @example - * ``` - * const client = longrunning.operationsClient(); - * const name = ''; - * const [response] = await client.getOperation({name}); - * // doThingsWith(response) - * ``` - */ - getOperation( - request: protos.google.longrunning.GetOperationRequest, - options?: - | gax.CallOptions - | Callback< - protos.google.longrunning.Operation, - protos.google.longrunning.GetOperationRequest, - {} | null | undefined - >, - callback?: Callback< - protos.google.longrunning.Operation, - protos.google.longrunning.GetOperationRequest, - {} | null | undefined - > - ): Promise<[protos.google.longrunning.Operation]> { - return this.operationsClient.getOperation(request, options, callback); - } - /** - * Lists operations that match the specified filter in the request. If the - * server doesn't support this method, it returns `UNIMPLEMENTED`. Returns an iterable object. - * - * For-await-of syntax is used with the iterable to recursively get response element on-demand. - * - * @param {Object} request - The request object that will be sent. - * @param {string} request.name - The name of the operation collection. - * @param {string} request.filter - The standard list filter. - * @param {number=} request.pageSize - - * The maximum number of resources contained in the underlying API - * response. If page streaming is performed per-resource, this - * parameter does not affect the return value. If page streaming is - * performed per-page, this determines the maximum number of - * resources in a page. - * @param {Object=} options - * Optional parameters. You can override the default settings for this call, - * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link - * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the - * details. - * @returns {Object} - * An iterable Object that conforms to @link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols. - * - * @example - * ``` - * const client = longrunning.operationsClient(); - * for await (const response of client.listOperationsAsync(request)); - * // doThingsWith(response) - * ``` - */ - listOperationsAsync( - request: protos.google.longrunning.ListOperationsRequest, - options?: gax.CallOptions - ): AsyncIterable { - return this.operationsClient.listOperationsAsync(request, options); - } - /** - * Starts asynchronous cancellation on a long-running operation. The server - * makes a best effort to cancel the operation, but success is not - * guaranteed. If the server doesn't support this method, it returns - * `google.rpc.Code.UNIMPLEMENTED`. Clients can use - * {@link Operations.GetOperation} or - * other methods to check whether the cancellation succeeded or whether the - * operation completed despite cancellation. On successful cancellation, - * the operation is not deleted; instead, it becomes an operation with - * an {@link Operation.error} value with a {@link google.rpc.Status.code} of - * 1, corresponding to `Code.CANCELLED`. - * - * @param {Object} request - The request object that will be sent. - * @param {string} request.name - The name of the operation resource to be cancelled. - * @param {Object=} options - * Optional parameters. You can override the default settings for this call, - * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link - * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the - * details. - * @param {function(?Error)=} callback - * The function which will be called with the result of the API call. - * @return {Promise} - The promise which resolves when API call finishes. - * The promise has a method named "cancel" which cancels the ongoing API - * call. - * - * @example - * ``` - * const client = longrunning.operationsClient(); - * await client.cancelOperation({name: ''}); - * ``` - */ - cancelOperation( - request: protos.google.longrunning.CancelOperationRequest, - options?: - | gax.CallOptions - | Callback< - protos.google.protobuf.Empty, - protos.google.longrunning.CancelOperationRequest, - {} | undefined | null - >, - callback?: Callback< - protos.google.longrunning.CancelOperationRequest, - protos.google.protobuf.Empty, - {} | undefined | null - > - ): Promise { - return this.operationsClient.cancelOperation(request, options, callback); - } - - /** - * Deletes a long-running operation. This method indicates that the client is - * no longer interested in the operation result. It does not cancel the - * operation. If the server doesn't support this method, it returns - * `google.rpc.Code.UNIMPLEMENTED`. - * - * @param {Object} request - The request object that will be sent. - * @param {string} request.name - The name of the operation resource to be deleted. - * @param {Object=} options - * Optional parameters. You can override the default settings for this call, - * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link - * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the - * details. - * @param {function(?Error)=} callback - * The function which will be called with the result of the API call. - * @return {Promise} - The promise which resolves when API call finishes. - * The promise has a method named "cancel" which cancels the ongoing API - * call. - * - * @example - * ``` - * const client = longrunning.operationsClient(); - * await client.deleteOperation({name: ''}); - * ``` - */ - deleteOperation( - request: protos.google.longrunning.DeleteOperationRequest, - options?: - | gax.CallOptions - | Callback< - protos.google.protobuf.Empty, - protos.google.longrunning.DeleteOperationRequest, - {} | null | undefined - >, - callback?: Callback< - protos.google.protobuf.Empty, - protos.google.longrunning.DeleteOperationRequest, - {} | null | undefined - > - ): Promise { - return this.operationsClient.deleteOperation(request, options, callback); - } - // -------------------- // -- Path templates -- // -------------------- @@ -2718,65 +2271,6 @@ export class HubServiceClient { .resource_id; } - /** - * Return a fully-qualified policyBasedRoute resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} policy_based_route - * @returns {string} Resource name string. - */ - policyBasedRoutePath( - project: string, - location: string, - policyBasedRoute: string - ) { - return this.pathTemplates.policyBasedRoutePathTemplate.render({ - project: project, - location: location, - policy_based_route: policyBasedRoute, - }); - } - - /** - * Parse the project from PolicyBasedRoute resource. - * - * @param {string} policyBasedRouteName - * A fully-qualified path representing PolicyBasedRoute resource. - * @returns {string} A string representing the project. - */ - matchProjectFromPolicyBasedRouteName(policyBasedRouteName: string) { - return this.pathTemplates.policyBasedRoutePathTemplate.match( - policyBasedRouteName - ).project; - } - - /** - * Parse the location from PolicyBasedRoute resource. - * - * @param {string} policyBasedRouteName - * A fully-qualified path representing PolicyBasedRoute resource. - * @returns {string} A string representing the location. - */ - matchLocationFromPolicyBasedRouteName(policyBasedRouteName: string) { - return this.pathTemplates.policyBasedRoutePathTemplate.match( - policyBasedRouteName - ).location; - } - - /** - * Parse the policy_based_route from PolicyBasedRoute resource. - * - * @param {string} policyBasedRouteName - * A fully-qualified path representing PolicyBasedRoute resource. - * @returns {string} A string representing the policy_based_route. - */ - matchPolicyBasedRouteFromPolicyBasedRouteName(policyBasedRouteName: string) { - return this.pathTemplates.policyBasedRoutePathTemplate.match( - policyBasedRouteName - ).policy_based_route; - } - /** * Return a fully-qualified spoke resource name string. * @@ -2888,8 +2382,6 @@ export class HubServiceClient { return this.hubServiceStub.then(stub => { this._terminated = true; stub.close(); - this.iamClient.close(); - this.locationsClient.close(); this.operationsClient.close(); }); } diff --git a/packages/google-cloud-networkconnectivity/src/v1/hub_service_proto_list.json b/packages/google-cloud-networkconnectivity/src/v1/hub_service_proto_list.json index d076e60ee41..ebe50faf7cb 100644 --- a/packages/google-cloud-networkconnectivity/src/v1/hub_service_proto_list.json +++ b/packages/google-cloud-networkconnectivity/src/v1/hub_service_proto_list.json @@ -1,5 +1,4 @@ [ "../../protos/google/cloud/networkconnectivity/v1/common.proto", - "../../protos/google/cloud/networkconnectivity/v1/hub.proto", - "../../protos/google/cloud/networkconnectivity/v1/policy_based_routing.proto" + "../../protos/google/cloud/networkconnectivity/v1/hub.proto" ] diff --git a/packages/google-cloud-networkconnectivity/src/v1/index.ts b/packages/google-cloud-networkconnectivity/src/v1/index.ts index 54add94f8e7..937a411a485 100644 --- a/packages/google-cloud-networkconnectivity/src/v1/index.ts +++ b/packages/google-cloud-networkconnectivity/src/v1/index.ts @@ -17,4 +17,3 @@ // ** All changes to this file may be overwritten. ** export {HubServiceClient} from './hub_service_client'; -export {PolicyBasedRoutingServiceClient} from './policy_based_routing_service_client'; diff --git a/packages/google-cloud-networkconnectivity/src/v1/policy_based_routing_service_client.ts b/packages/google-cloud-networkconnectivity/src/v1/policy_based_routing_service_client.ts deleted file mode 100644 index dfafa9f5d07..00000000000 --- a/packages/google-cloud-networkconnectivity/src/v1/policy_based_routing_service_client.ts +++ /dev/null @@ -1,1768 +0,0 @@ -// Copyright 2023 Google LLC -// -// 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 -// -// https://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. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -/* global window */ -import type * as gax from 'google-gax'; -import type { - Callback, - CallOptions, - Descriptors, - ClientOptions, - GrpcClientOptions, - LROperation, - PaginationCallback, - GaxCall, - IamClient, - IamProtos, - LocationsClient, - LocationProtos, -} from 'google-gax'; -import {Transform} from 'stream'; -import * as protos from '../../protos/protos'; -import jsonProtos = require('../../protos/protos.json'); -/** - * Client JSON configuration object, loaded from - * `src/v1/policy_based_routing_service_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './policy_based_routing_service_client_config.json'; -const version = require('../../../package.json').version; - -/** - * Policy-Based Routing allows GCP customers to specify flexibile routing - * policies for Layer 4 traffic traversing through the connected service. - * @class - * @memberof v1 - */ -export class PolicyBasedRoutingServiceClient { - private _terminated = false; - private _opts: ClientOptions; - private _providedCustomServicePath: boolean; - private _gaxModule: typeof gax | typeof gax.fallback; - private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; - private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; - auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; - iamClient: IamClient; - locationsClient: LocationsClient; - pathTemplates: {[name: string]: gax.PathTemplate}; - operationsClient: gax.OperationsClient; - policyBasedRoutingServiceStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of PolicyBasedRoutingServiceClient. - * - * @param {object} [options] - The configuration object. - * The options accepted by the constructor are described in detail - * in [this document](https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#creating-the-client-instance). - * The common options are: - * @param {object} [options.credentials] - Credentials object. - * @param {string} [options.credentials.client_email] - * @param {string} [options.credentials.private_key] - * @param {string} [options.email] - Account email address. Required when - * using a .pem or .p12 keyFilename. - * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or - * .p12 key downloaded from the Google Developers Console. If you provide - * a path to a JSON file, the projectId option below is not necessary. - * NOTE: .pem and .p12 require you to specify options.email as well. - * @param {number} [options.port] - The port on which to connect to - * the remote host. - * @param {string} [options.projectId] - The project ID from the Google - * Developer's Console, e.g. 'grape-spaceship-123'. We will also check - * the environment variable GCLOUD_PROJECT for your project ID. If your - * app is running in an environment which supports - * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials}, - * your project ID will be detected automatically. - * @param {string} [options.apiEndpoint] - The domain name of the - * API remote host. - * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. - * Follows the structure of {@link gapicConfig}. - * @param {boolean | "rest"} [options.fallback] - Use HTTP fallback mode. - * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. - * For more information, please check the - * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. - * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you - * need to avoid loading the default gRPC version and want to use the fallback - * HTTP implementation. Load only fallback version and pass it to the constructor: - * ``` - * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC - * const client = new PolicyBasedRoutingServiceClient({fallback: 'rest'}, gax); - * ``` - */ - constructor( - opts?: ClientOptions, - gaxInstance?: typeof gax | typeof gax.fallback - ) { - // Ensure that options include all the required fields. - const staticMembers = this - .constructor as typeof PolicyBasedRoutingServiceClient; - const servicePath = - opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; - this._providedCustomServicePath = !!( - opts?.servicePath || opts?.apiEndpoint - ); - const port = opts?.port || staticMembers.port; - const clientConfig = opts?.clientConfig ?? {}; - const fallback = - opts?.fallback ?? - (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); - - // Request numeric enum values if REST transport is used. - opts.numericEnums = true; - - // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { - opts['scopes'] = staticMembers.scopes; - } - - // Load google-gax module synchronously if needed - if (!gaxInstance) { - gaxInstance = require('google-gax') as typeof gax; - } - - // Choose either gRPC or proto-over-HTTP implementation of google-gax. - this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; - - // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. - this._gaxGrpc = new this._gaxModule.GrpcClient(opts); - - // Save options to use in initialize() method. - this._opts = opts; - - // Save the auth object to the client, for use by other methods. - this.auth = this._gaxGrpc.auth as gax.GoogleAuth; - - // Set useJWTAccessWithScope on the auth object. - this.auth.useJWTAccessWithScope = true; - - // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = staticMembers.servicePath; - - // Set the default scopes in auth client if needed. - if (servicePath === staticMembers.servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - this.iamClient = new this._gaxModule.IamClient(this._gaxGrpc, opts); - - this.locationsClient = new this._gaxModule.LocationsClient( - this._gaxGrpc, - opts - ); - - // Determine the client header string. - const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; - if (typeof process !== 'undefined' && 'versions' in process) { - clientHeader.push(`gl-node/${process.versions.node}`); - } else { - clientHeader.push(`gl-web/${this._gaxModule.version}`); - } - if (!opts.fallback) { - clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); - } else if (opts.fallback === 'rest') { - clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); - } - if (opts.libName && opts.libVersion) { - clientHeader.push(`${opts.libName}/${opts.libVersion}`); - } - // Load the applicable protos. - this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); - - // This API contains "path templates"; forward-slash-separated - // identifiers to uniquely identify resources within the API. - // Create useful helper objects for these. - this.pathTemplates = { - hubPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/global/hubs/{hub}' - ), - locationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}' - ), - networkPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/global/networks/{resource_id}' - ), - policyBasedRoutePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/{location}/global/PolicyBasedRoutes/{policy_based_route}' - ), - spokePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/spokes/{spoke}' - ), - }; - - // Some of the methods on this service return "paged" results, - // (e.g. 50 results at a time, with tokens to get subsequent - // pages). Denote the keys used for pagination and results. - this.descriptors.page = { - listPolicyBasedRoutes: new this._gaxModule.PageDescriptor( - 'pageToken', - 'nextPageToken', - 'policyBasedRoutes' - ), - }; - - const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(jsonProtos); - // This API contains "long-running operations", which return a - // an Operation object that allows for tracking of the operation, - // rather than holding a request open. - const lroOptions: GrpcClientOptions = { - auth: this.auth, - grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined, - }; - if (opts.fallback === 'rest') { - lroOptions.protoJson = protoFilesRoot; - lroOptions.httpRules = [ - { - selector: 'google.cloud.location.Locations.GetLocation', - get: '/v1/{name=projects/*/locations/*}', - }, - { - selector: 'google.cloud.location.Locations.ListLocations', - get: '/v1/{name=projects/*}/locations', - }, - { - selector: 'google.iam.v1.IAMPolicy.GetIamPolicy', - get: '/v1/{resource=projects/*/locations/global/hubs/*}:getIamPolicy', - additional_bindings: [ - { - get: '/v1/{resource=projects/*/locations/*/spokes/*}:getIamPolicy', - }, - { - get: '/v1/{resource=projects/*/locations/global/policyBasedRoutes/*}:getIamPolicy', - }, - { - get: '/v1/{resource=projects/*/locations/*/serviceConnectionMaps/*}:getIamPolicy', - }, - { - get: '/v1/{resource=projects/*/locations/*/serviceConnectionPolicies/*}:getIamPolicy', - }, - { - get: '/v1/{resource=projects/*/locations/*/serviceClasses/*}:getIamPolicy', - }, - ], - }, - { - selector: 'google.iam.v1.IAMPolicy.SetIamPolicy', - post: '/v1/{resource=projects/*/locations/global/hubs/*}:setIamPolicy', - body: '*', - additional_bindings: [ - { - post: '/v1/{resource=projects/*/locations/*/spokes/*}:setIamPolicy', - body: '*', - }, - { - post: '/v1/{resource=projects/*/locations/global/policyBasedRoutes/*}:setIamPolicy', - body: '*', - }, - { - post: '/v1/{resource=projects/*/locations/*/serviceConnectionMaps/*}:setIamPolicy', - body: '*', - }, - { - post: '/v1/{resource=projects/*/locations/*/serviceConnectionPolicies/*}:setIamPolicy', - body: '*', - }, - { - post: '/v1/{resource=projects/*/locations/*/serviceClasses/*}:setIamPolicy', - body: '*', - }, - ], - }, - { - selector: 'google.iam.v1.IAMPolicy.TestIamPermissions', - post: '/v1/{resource=projects/*/locations/global/hubs/*}:testIamPermissions', - body: '*', - additional_bindings: [ - { - post: '/v1/{resource=projects/*/locations/*/spokes/*}:testIamPermissions', - body: '*', - }, - { - post: '/v1/{resource=projects/*/locations/global/policyBasedRoutes/*}:testIamPermissions', - body: '*', - }, - { - post: '/v1/{resource=projects/*/locations/*/serviceConnectionMaps/*}:testIamPermissions', - body: '*', - }, - { - post: '/v1/{resource=projects/*/locations/*/serviceConnectionPolicies/*}:testIamPermissions', - body: '*', - }, - { - post: '/v1/{resource=projects/*/locations/*/serviceClasses/*}:testIamPermissions', - body: '*', - }, - ], - }, - { - selector: 'google.longrunning.Operations.CancelOperation', - post: '/v1/{name=projects/*/locations/*/operations/*}:cancel', - body: '*', - }, - { - selector: 'google.longrunning.Operations.DeleteOperation', - delete: '/v1/{name=projects/*/locations/*/operations/*}', - }, - { - selector: 'google.longrunning.Operations.GetOperation', - get: '/v1/{name=projects/*/locations/*/operations/*}', - }, - { - selector: 'google.longrunning.Operations.ListOperations', - get: '/v1/{name=projects/*/locations/*}/operations', - }, - ]; - } - this.operationsClient = this._gaxModule - .lro(lroOptions) - .operationsClient(opts); - const createPolicyBasedRouteResponse = protoFilesRoot.lookup( - '.google.cloud.networkconnectivity.v1.PolicyBasedRoute' - ) as gax.protobuf.Type; - const createPolicyBasedRouteMetadata = protoFilesRoot.lookup( - '.google.cloud.networkconnectivity.v1.OperationMetadata' - ) as gax.protobuf.Type; - const deletePolicyBasedRouteResponse = protoFilesRoot.lookup( - '.google.protobuf.Empty' - ) as gax.protobuf.Type; - const deletePolicyBasedRouteMetadata = protoFilesRoot.lookup( - '.google.cloud.networkconnectivity.v1.OperationMetadata' - ) as gax.protobuf.Type; - - this.descriptors.longrunning = { - createPolicyBasedRoute: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - createPolicyBasedRouteResponse.decode.bind( - createPolicyBasedRouteResponse - ), - createPolicyBasedRouteMetadata.decode.bind( - createPolicyBasedRouteMetadata - ) - ), - deletePolicyBasedRoute: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - deletePolicyBasedRouteResponse.decode.bind( - deletePolicyBasedRouteResponse - ), - deletePolicyBasedRouteMetadata.decode.bind( - deletePolicyBasedRouteMetadata - ) - ), - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.networkconnectivity.v1.PolicyBasedRoutingService', - gapicConfig as gax.ClientConfig, - opts.clientConfig || {}, - {'x-goog-api-client': clientHeader.join(' ')} - ); - - // Set up a dictionary of "inner API calls"; the core implementation - // of calling the API is handled in `google-gax`, with this code - // merely providing the destination and request information. - this.innerApiCalls = {}; - - // Add a warn function to the client constructor so it can be easily tested. - this.warn = this._gaxModule.warn; - } - - /** - * Initialize the client. - * Performs asynchronous operations (such as authentication) and prepares the client. - * This function will be called automatically when any class method is called for the - * first time, but if you need to initialize it before calling an actual method, - * feel free to call initialize() directly. - * - * You can await on this method if you want to make sure the client is initialized. - * - * @returns {Promise} A promise that resolves to an authenticated service stub. - */ - initialize() { - // If the client stub promise is already initialized, return immediately. - if (this.policyBasedRoutingServiceStub) { - return this.policyBasedRoutingServiceStub; - } - - // Put together the "service stub" for - // google.cloud.networkconnectivity.v1.PolicyBasedRoutingService. - this.policyBasedRoutingServiceStub = this._gaxGrpc.createStub( - this._opts.fallback - ? (this._protos as protobuf.Root).lookupService( - 'google.cloud.networkconnectivity.v1.PolicyBasedRoutingService' - ) - : // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.networkconnectivity.v1 - .PolicyBasedRoutingService, - this._opts, - this._providedCustomServicePath - ) as Promise<{[method: string]: Function}>; - - // Iterate over each of the methods that the service provides - // and create an API call method for each. - const policyBasedRoutingServiceStubMethods = [ - 'listPolicyBasedRoutes', - 'getPolicyBasedRoute', - 'createPolicyBasedRoute', - 'deletePolicyBasedRoute', - ]; - for (const methodName of policyBasedRoutingServiceStubMethods) { - const callPromise = this.policyBasedRoutingServiceStub.then( - stub => - (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error | null | undefined) => () => { - throw err; - } - ); - - const descriptor = - this.descriptors.page[methodName] || - this.descriptors.longrunning[methodName] || - undefined; - const apiCall = this._gaxModule.createApiCall( - callPromise, - this._defaults[methodName], - descriptor, - this._opts.fallback - ); - - this.innerApiCalls[methodName] = apiCall; - } - - return this.policyBasedRoutingServiceStub; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - return 'networkconnectivity.googleapis.com'; - } - - /** - * The DNS address for this API service - same as servicePath(), - * exists for compatibility reasons. - * @returns {string} The DNS address for this service. - */ - static get apiEndpoint() { - return 'networkconnectivity.googleapis.com'; - } - - /** - * The port for this API service. - * @returns {number} The default port for this service. - */ - static get port() { - return 443; - } - - /** - * The scopes needed to make gRPC calls for every method defined - * in this service. - * @returns {string[]} List of default scopes. - */ - static get scopes() { - return ['https://www.googleapis.com/auth/cloud-platform']; - } - - getProjectId(): Promise; - getProjectId(callback: Callback): void; - /** - * Return the project ID used by this class. - * @returns {Promise} A promise that resolves to string containing the project ID. - */ - getProjectId( - callback?: Callback - ): Promise | void { - if (callback) { - this.auth.getProjectId(callback); - return; - } - return this.auth.getProjectId(); - } - - // ------------------- - // -- Service calls -- - // ------------------- - /** - * Gets details of a single PolicyBasedRoute. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Name of the PolicyBasedRoute resource to get. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [PolicyBasedRoute]{@link google.cloud.networkconnectivity.v1.PolicyBasedRoute}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1/policy_based_routing_service.get_policy_based_route.js - * region_tag:networkconnectivity_v1_generated_PolicyBasedRoutingService_GetPolicyBasedRoute_async - */ - getPolicyBasedRoute( - request?: protos.google.cloud.networkconnectivity.v1.IGetPolicyBasedRouteRequest, - options?: CallOptions - ): Promise< - [ - protos.google.cloud.networkconnectivity.v1.IPolicyBasedRoute, - ( - | protos.google.cloud.networkconnectivity.v1.IGetPolicyBasedRouteRequest - | undefined - ), - {} | undefined - ] - >; - getPolicyBasedRoute( - request: protos.google.cloud.networkconnectivity.v1.IGetPolicyBasedRouteRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.networkconnectivity.v1.IPolicyBasedRoute, - | protos.google.cloud.networkconnectivity.v1.IGetPolicyBasedRouteRequest - | null - | undefined, - {} | null | undefined - > - ): void; - getPolicyBasedRoute( - request: protos.google.cloud.networkconnectivity.v1.IGetPolicyBasedRouteRequest, - callback: Callback< - protos.google.cloud.networkconnectivity.v1.IPolicyBasedRoute, - | protos.google.cloud.networkconnectivity.v1.IGetPolicyBasedRouteRequest - | null - | undefined, - {} | null | undefined - > - ): void; - getPolicyBasedRoute( - request?: protos.google.cloud.networkconnectivity.v1.IGetPolicyBasedRouteRequest, - optionsOrCallback?: - | CallOptions - | Callback< - protos.google.cloud.networkconnectivity.v1.IPolicyBasedRoute, - | protos.google.cloud.networkconnectivity.v1.IGetPolicyBasedRouteRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.cloud.networkconnectivity.v1.IPolicyBasedRoute, - | protos.google.cloud.networkconnectivity.v1.IGetPolicyBasedRouteRequest - | null - | undefined, - {} | null | undefined - > - ): Promise< - [ - protos.google.cloud.networkconnectivity.v1.IPolicyBasedRoute, - ( - | protos.google.cloud.networkconnectivity.v1.IGetPolicyBasedRouteRequest - | undefined - ), - {} | undefined - ] - > | void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - name: request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.getPolicyBasedRoute(request, options, callback); - } - - /** - * Creates a new PolicyBasedRoute in a given project and location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource's name of the PolicyBasedRoute. - * @param {string} [request.policyBasedRouteId] - * Optional. Unique id for the Policy Based Route to create. - * @param {google.cloud.networkconnectivity.v1.PolicyBasedRoute} request.policyBasedRoute - * Required. Initial values for a new Policy Based Route. - * @param {string} [request.requestId] - * Optional. An optional request ID to identify requests. Specify a unique request ID - * so that if you must retry your request, the server will know to ignore - * the request if it has already been completed. The server will guarantee - * that for at least 60 minutes since the first request. - * - * For example, consider a situation where you make an initial request and t - * he request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v1/policy_based_routing_service.create_policy_based_route.js - * region_tag:networkconnectivity_v1_generated_PolicyBasedRoutingService_CreatePolicyBasedRoute_async - */ - createPolicyBasedRoute( - request?: protos.google.cloud.networkconnectivity.v1.ICreatePolicyBasedRouteRequest, - options?: CallOptions - ): Promise< - [ - LROperation< - protos.google.cloud.networkconnectivity.v1.IPolicyBasedRoute, - protos.google.cloud.networkconnectivity.v1.IOperationMetadata - >, - protos.google.longrunning.IOperation | undefined, - {} | undefined - ] - >; - createPolicyBasedRoute( - request: protos.google.cloud.networkconnectivity.v1.ICreatePolicyBasedRouteRequest, - options: CallOptions, - callback: Callback< - LROperation< - protos.google.cloud.networkconnectivity.v1.IPolicyBasedRoute, - protos.google.cloud.networkconnectivity.v1.IOperationMetadata - >, - protos.google.longrunning.IOperation | null | undefined, - {} | null | undefined - > - ): void; - createPolicyBasedRoute( - request: protos.google.cloud.networkconnectivity.v1.ICreatePolicyBasedRouteRequest, - callback: Callback< - LROperation< - protos.google.cloud.networkconnectivity.v1.IPolicyBasedRoute, - protos.google.cloud.networkconnectivity.v1.IOperationMetadata - >, - protos.google.longrunning.IOperation | null | undefined, - {} | null | undefined - > - ): void; - createPolicyBasedRoute( - request?: protos.google.cloud.networkconnectivity.v1.ICreatePolicyBasedRouteRequest, - optionsOrCallback?: - | CallOptions - | Callback< - LROperation< - protos.google.cloud.networkconnectivity.v1.IPolicyBasedRoute, - protos.google.cloud.networkconnectivity.v1.IOperationMetadata - >, - protos.google.longrunning.IOperation | null | undefined, - {} | null | undefined - >, - callback?: Callback< - LROperation< - protos.google.cloud.networkconnectivity.v1.IPolicyBasedRoute, - protos.google.cloud.networkconnectivity.v1.IOperationMetadata - >, - protos.google.longrunning.IOperation | null | undefined, - {} | null | undefined - > - ): Promise< - [ - LROperation< - protos.google.cloud.networkconnectivity.v1.IPolicyBasedRoute, - protos.google.cloud.networkconnectivity.v1.IOperationMetadata - >, - protos.google.longrunning.IOperation | undefined, - {} | undefined - ] - > | void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - parent: request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.createPolicyBasedRoute( - request, - options, - callback - ); - } - /** - * Check the status of the long running operation returned by `createPolicyBasedRoute()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v1/policy_based_routing_service.create_policy_based_route.js - * region_tag:networkconnectivity_v1_generated_PolicyBasedRoutingService_CreatePolicyBasedRoute_async - */ - async checkCreatePolicyBasedRouteProgress( - name: string - ): Promise< - LROperation< - protos.google.cloud.networkconnectivity.v1.PolicyBasedRoute, - protos.google.cloud.networkconnectivity.v1.OperationMetadata - > - > { - const request = - new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( - {name} - ); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation( - operation, - this.descriptors.longrunning.createPolicyBasedRoute, - this._gaxModule.createDefaultBackoffSettings() - ); - return decodeOperation as LROperation< - protos.google.cloud.networkconnectivity.v1.PolicyBasedRoute, - protos.google.cloud.networkconnectivity.v1.OperationMetadata - >; - } - /** - * Deletes a single PolicyBasedRoute. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Name of the PolicyBasedRoute resource to delete. - * @param {string} [request.requestId] - * Optional. An optional request ID to identify requests. Specify a unique request ID - * so that if you must retry your request, the server will know to ignore - * the request if it has already been completed. The server will guarantee - * that for at least 60 minutes after the first request. - * - * For example, consider a situation where you make an initial request and t - * he request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v1/policy_based_routing_service.delete_policy_based_route.js - * region_tag:networkconnectivity_v1_generated_PolicyBasedRoutingService_DeletePolicyBasedRoute_async - */ - deletePolicyBasedRoute( - request?: protos.google.cloud.networkconnectivity.v1.IDeletePolicyBasedRouteRequest, - options?: CallOptions - ): Promise< - [ - LROperation< - protos.google.protobuf.IEmpty, - protos.google.cloud.networkconnectivity.v1.IOperationMetadata - >, - protos.google.longrunning.IOperation | undefined, - {} | undefined - ] - >; - deletePolicyBasedRoute( - request: protos.google.cloud.networkconnectivity.v1.IDeletePolicyBasedRouteRequest, - options: CallOptions, - callback: Callback< - LROperation< - protos.google.protobuf.IEmpty, - protos.google.cloud.networkconnectivity.v1.IOperationMetadata - >, - protos.google.longrunning.IOperation | null | undefined, - {} | null | undefined - > - ): void; - deletePolicyBasedRoute( - request: protos.google.cloud.networkconnectivity.v1.IDeletePolicyBasedRouteRequest, - callback: Callback< - LROperation< - protos.google.protobuf.IEmpty, - protos.google.cloud.networkconnectivity.v1.IOperationMetadata - >, - protos.google.longrunning.IOperation | null | undefined, - {} | null | undefined - > - ): void; - deletePolicyBasedRoute( - request?: protos.google.cloud.networkconnectivity.v1.IDeletePolicyBasedRouteRequest, - optionsOrCallback?: - | CallOptions - | Callback< - LROperation< - protos.google.protobuf.IEmpty, - protos.google.cloud.networkconnectivity.v1.IOperationMetadata - >, - protos.google.longrunning.IOperation | null | undefined, - {} | null | undefined - >, - callback?: Callback< - LROperation< - protos.google.protobuf.IEmpty, - protos.google.cloud.networkconnectivity.v1.IOperationMetadata - >, - protos.google.longrunning.IOperation | null | undefined, - {} | null | undefined - > - ): Promise< - [ - LROperation< - protos.google.protobuf.IEmpty, - protos.google.cloud.networkconnectivity.v1.IOperationMetadata - >, - protos.google.longrunning.IOperation | undefined, - {} | undefined - ] - > | void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - name: request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.deletePolicyBasedRoute( - request, - options, - callback - ); - } - /** - * Check the status of the long running operation returned by `deletePolicyBasedRoute()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v1/policy_based_routing_service.delete_policy_based_route.js - * region_tag:networkconnectivity_v1_generated_PolicyBasedRoutingService_DeletePolicyBasedRoute_async - */ - async checkDeletePolicyBasedRouteProgress( - name: string - ): Promise< - LROperation< - protos.google.protobuf.Empty, - protos.google.cloud.networkconnectivity.v1.OperationMetadata - > - > { - const request = - new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( - {name} - ); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation( - operation, - this.descriptors.longrunning.deletePolicyBasedRoute, - this._gaxModule.createDefaultBackoffSettings() - ); - return decodeOperation as LROperation< - protos.google.protobuf.Empty, - protos.google.cloud.networkconnectivity.v1.OperationMetadata - >; - } - /** - * Lists PolicyBasedRoutes in a given project and location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource's name. - * @param {number} request.pageSize - * The maximum number of results per page that should be returned. - * @param {string} request.pageToken - * The page token. - * @param {string} request.filter - * A filter expression that filters the results listed in the response. - * @param {string} request.orderBy - * Sort the results by a certain order. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is Array of [PolicyBasedRoute]{@link google.cloud.networkconnectivity.v1.PolicyBasedRoute}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listPolicyBasedRoutesAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - */ - listPolicyBasedRoutes( - request?: protos.google.cloud.networkconnectivity.v1.IListPolicyBasedRoutesRequest, - options?: CallOptions - ): Promise< - [ - protos.google.cloud.networkconnectivity.v1.IPolicyBasedRoute[], - protos.google.cloud.networkconnectivity.v1.IListPolicyBasedRoutesRequest | null, - protos.google.cloud.networkconnectivity.v1.IListPolicyBasedRoutesResponse - ] - >; - listPolicyBasedRoutes( - request: protos.google.cloud.networkconnectivity.v1.IListPolicyBasedRoutesRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.networkconnectivity.v1.IListPolicyBasedRoutesRequest, - | protos.google.cloud.networkconnectivity.v1.IListPolicyBasedRoutesResponse - | null - | undefined, - protos.google.cloud.networkconnectivity.v1.IPolicyBasedRoute - > - ): void; - listPolicyBasedRoutes( - request: protos.google.cloud.networkconnectivity.v1.IListPolicyBasedRoutesRequest, - callback: PaginationCallback< - protos.google.cloud.networkconnectivity.v1.IListPolicyBasedRoutesRequest, - | protos.google.cloud.networkconnectivity.v1.IListPolicyBasedRoutesResponse - | null - | undefined, - protos.google.cloud.networkconnectivity.v1.IPolicyBasedRoute - > - ): void; - listPolicyBasedRoutes( - request?: protos.google.cloud.networkconnectivity.v1.IListPolicyBasedRoutesRequest, - optionsOrCallback?: - | CallOptions - | PaginationCallback< - protos.google.cloud.networkconnectivity.v1.IListPolicyBasedRoutesRequest, - | protos.google.cloud.networkconnectivity.v1.IListPolicyBasedRoutesResponse - | null - | undefined, - protos.google.cloud.networkconnectivity.v1.IPolicyBasedRoute - >, - callback?: PaginationCallback< - protos.google.cloud.networkconnectivity.v1.IListPolicyBasedRoutesRequest, - | protos.google.cloud.networkconnectivity.v1.IListPolicyBasedRoutesResponse - | null - | undefined, - protos.google.cloud.networkconnectivity.v1.IPolicyBasedRoute - > - ): Promise< - [ - protos.google.cloud.networkconnectivity.v1.IPolicyBasedRoute[], - protos.google.cloud.networkconnectivity.v1.IListPolicyBasedRoutesRequest | null, - protos.google.cloud.networkconnectivity.v1.IListPolicyBasedRoutesResponse - ] - > | void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - parent: request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.listPolicyBasedRoutes(request, options, callback); - } - - /** - * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource's name. - * @param {number} request.pageSize - * The maximum number of results per page that should be returned. - * @param {string} request.pageToken - * The page token. - * @param {string} request.filter - * A filter expression that filters the results listed in the response. - * @param {string} request.orderBy - * Sort the results by a certain order. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing [PolicyBasedRoute]{@link google.cloud.networkconnectivity.v1.PolicyBasedRoute} on 'data' event. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed. Note that it can affect your quota. - * We recommend using `listPolicyBasedRoutesAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - */ - listPolicyBasedRoutesStream( - request?: protos.google.cloud.networkconnectivity.v1.IListPolicyBasedRoutesRequest, - options?: CallOptions - ): Transform { - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - parent: request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listPolicyBasedRoutes']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listPolicyBasedRoutes.createStream( - this.innerApiCalls.listPolicyBasedRoutes as GaxCall, - request, - callSettings - ); - } - - /** - * Equivalent to `listPolicyBasedRoutes`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource's name. - * @param {number} request.pageSize - * The maximum number of results per page that should be returned. - * @param {string} request.pageToken - * The page token. - * @param {string} request.filter - * A filter expression that filters the results listed in the response. - * @param {string} request.orderBy - * Sort the results by a certain order. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). - * When you iterate the returned iterable, each element will be an object representing - * [PolicyBasedRoute]{@link google.cloud.networkconnectivity.v1.PolicyBasedRoute}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - * @example include:samples/generated/v1/policy_based_routing_service.list_policy_based_routes.js - * region_tag:networkconnectivity_v1_generated_PolicyBasedRoutingService_ListPolicyBasedRoutes_async - */ - listPolicyBasedRoutesAsync( - request?: protos.google.cloud.networkconnectivity.v1.IListPolicyBasedRoutesRequest, - options?: CallOptions - ): AsyncIterable { - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - parent: request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listPolicyBasedRoutes']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listPolicyBasedRoutes.asyncIterate( - this.innerApiCalls['listPolicyBasedRoutes'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - /** - * Gets the access control policy for a resource. Returns an empty policy - * if the resource exists and does not have a policy set. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.resource - * REQUIRED: The resource for which the policy is being requested. - * See the operation documentation for the appropriate value for this field. - * @param {Object} [request.options] - * OPTIONAL: A `GetPolicyOptions` object for specifying options to - * `GetIamPolicy`. This field is only used by Cloud IAM. - * - * This object should have the same structure as [GetPolicyOptions]{@link google.iam.v1.GetPolicyOptions} - * @param {Object} [options] - * Optional parameters. You can override the default settings for this call, e.g, timeout, - * retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html} for the details. - * @param {function(?Error, ?Object)} [callback] - * The function which will be called with the result of the API call. - * - * The second parameter to the callback is an object representing [Policy]{@link google.iam.v1.Policy}. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [Policy]{@link google.iam.v1.Policy}. - * The promise has a method named "cancel" which cancels the ongoing API call. - */ - getIamPolicy( - request: IamProtos.google.iam.v1.GetIamPolicyRequest, - options?: - | gax.CallOptions - | Callback< - IamProtos.google.iam.v1.Policy, - IamProtos.google.iam.v1.GetIamPolicyRequest | null | undefined, - {} | null | undefined - >, - callback?: Callback< - IamProtos.google.iam.v1.Policy, - IamProtos.google.iam.v1.GetIamPolicyRequest | null | undefined, - {} | null | undefined - > - ): Promise { - return this.iamClient.getIamPolicy(request, options, callback); - } - - /** - * Returns permissions that a caller has on the specified resource. If the - * resource does not exist, this will return an empty set of - * permissions, not a NOT_FOUND error. - * - * Note: This operation is designed to be used for building - * permission-aware UIs and command-line tools, not for authorization - * checking. This operation may "fail open" without warning. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.resource - * REQUIRED: The resource for which the policy detail is being requested. - * See the operation documentation for the appropriate value for this field. - * @param {string[]} request.permissions - * The set of permissions to check for the `resource`. Permissions with - * wildcards (such as '*' or 'storage.*') are not allowed. For more - * information see - * [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions). - * @param {Object} [options] - * Optional parameters. You can override the default settings for this call, e.g, timeout, - * retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html} for the details. - * @param {function(?Error, ?Object)} [callback] - * The function which will be called with the result of the API call. - * - * The second parameter to the callback is an object representing [TestIamPermissionsResponse]{@link google.iam.v1.TestIamPermissionsResponse}. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [TestIamPermissionsResponse]{@link google.iam.v1.TestIamPermissionsResponse}. - * The promise has a method named "cancel" which cancels the ongoing API call. - */ - setIamPolicy( - request: IamProtos.google.iam.v1.SetIamPolicyRequest, - options?: - | gax.CallOptions - | Callback< - IamProtos.google.iam.v1.Policy, - IamProtos.google.iam.v1.SetIamPolicyRequest | null | undefined, - {} | null | undefined - >, - callback?: Callback< - IamProtos.google.iam.v1.Policy, - IamProtos.google.iam.v1.SetIamPolicyRequest | null | undefined, - {} | null | undefined - > - ): Promise { - return this.iamClient.setIamPolicy(request, options, callback); - } - - /** - * Returns permissions that a caller has on the specified resource. If the - * resource does not exist, this will return an empty set of - * permissions, not a NOT_FOUND error. - * - * Note: This operation is designed to be used for building - * permission-aware UIs and command-line tools, not for authorization - * checking. This operation may "fail open" without warning. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.resource - * REQUIRED: The resource for which the policy detail is being requested. - * See the operation documentation for the appropriate value for this field. - * @param {string[]} request.permissions - * The set of permissions to check for the `resource`. Permissions with - * wildcards (such as '*' or 'storage.*') are not allowed. For more - * information see - * [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions). - * @param {Object} [options] - * Optional parameters. You can override the default settings for this call, e.g, timeout, - * retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html} for the details. - * @param {function(?Error, ?Object)} [callback] - * The function which will be called with the result of the API call. - * - * The second parameter to the callback is an object representing [TestIamPermissionsResponse]{@link google.iam.v1.TestIamPermissionsResponse}. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [TestIamPermissionsResponse]{@link google.iam.v1.TestIamPermissionsResponse}. - * The promise has a method named "cancel" which cancels the ongoing API call. - * - */ - testIamPermissions( - request: IamProtos.google.iam.v1.TestIamPermissionsRequest, - options?: - | gax.CallOptions - | Callback< - IamProtos.google.iam.v1.TestIamPermissionsResponse, - IamProtos.google.iam.v1.TestIamPermissionsRequest | null | undefined, - {} | null | undefined - >, - callback?: Callback< - IamProtos.google.iam.v1.TestIamPermissionsResponse, - IamProtos.google.iam.v1.TestIamPermissionsRequest | null | undefined, - {} | null | undefined - > - ): Promise { - return this.iamClient.testIamPermissions(request, options, callback); - } - - /** - * Gets information about a location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Resource name for the location. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [Location]{@link google.cloud.location.Location}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example - * ``` - * const [response] = await client.getLocation(request); - * ``` - */ - getLocation( - request: LocationProtos.google.cloud.location.IGetLocationRequest, - options?: - | gax.CallOptions - | Callback< - LocationProtos.google.cloud.location.ILocation, - | LocationProtos.google.cloud.location.IGetLocationRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - LocationProtos.google.cloud.location.ILocation, - | LocationProtos.google.cloud.location.IGetLocationRequest - | null - | undefined, - {} | null | undefined - > - ): Promise { - return this.locationsClient.getLocation(request, options, callback); - } - - /** - * Lists information about the supported locations for this service. Returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * The resource that owns the locations collection, if applicable. - * @param {string} request.filter - * The standard list filter. - * @param {number} request.pageSize - * The standard list page size. - * @param {string} request.pageToken - * The standard list page token. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). - * When you iterate the returned iterable, each element will be an object representing - * [Location]{@link google.cloud.location.Location}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - * @example - * ``` - * const iterable = client.listLocationsAsync(request); - * for await (const response of iterable) { - * // process response - * } - * ``` - */ - listLocationsAsync( - request: LocationProtos.google.cloud.location.IListLocationsRequest, - options?: CallOptions - ): AsyncIterable { - return this.locationsClient.listLocationsAsync(request, options); - } - - /** - * Gets the latest state of a long-running operation. Clients can use this - * method to poll the operation result at intervals as recommended by the API - * service. - * - * @param {Object} request - The request object that will be sent. - * @param {string} request.name - The name of the operation resource. - * @param {Object=} options - * Optional parameters. You can override the default settings for this call, - * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link - * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the - * details. - * @param {function(?Error, ?Object)=} callback - * The function which will be called with the result of the API call. - * - * The second parameter to the callback is an object representing - * [google.longrunning.Operation]{@link - * external:"google.longrunning.Operation"}. - * @return {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * [google.longrunning.Operation]{@link - * external:"google.longrunning.Operation"}. The promise has a method named - * "cancel" which cancels the ongoing API call. - * - * @example - * ``` - * const client = longrunning.operationsClient(); - * const name = ''; - * const [response] = await client.getOperation({name}); - * // doThingsWith(response) - * ``` - */ - getOperation( - request: protos.google.longrunning.GetOperationRequest, - options?: - | gax.CallOptions - | Callback< - protos.google.longrunning.Operation, - protos.google.longrunning.GetOperationRequest, - {} | null | undefined - >, - callback?: Callback< - protos.google.longrunning.Operation, - protos.google.longrunning.GetOperationRequest, - {} | null | undefined - > - ): Promise<[protos.google.longrunning.Operation]> { - return this.operationsClient.getOperation(request, options, callback); - } - /** - * Lists operations that match the specified filter in the request. If the - * server doesn't support this method, it returns `UNIMPLEMENTED`. Returns an iterable object. - * - * For-await-of syntax is used with the iterable to recursively get response element on-demand. - * - * @param {Object} request - The request object that will be sent. - * @param {string} request.name - The name of the operation collection. - * @param {string} request.filter - The standard list filter. - * @param {number=} request.pageSize - - * The maximum number of resources contained in the underlying API - * response. If page streaming is performed per-resource, this - * parameter does not affect the return value. If page streaming is - * performed per-page, this determines the maximum number of - * resources in a page. - * @param {Object=} options - * Optional parameters. You can override the default settings for this call, - * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link - * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the - * details. - * @returns {Object} - * An iterable Object that conforms to @link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols. - * - * @example - * ``` - * const client = longrunning.operationsClient(); - * for await (const response of client.listOperationsAsync(request)); - * // doThingsWith(response) - * ``` - */ - listOperationsAsync( - request: protos.google.longrunning.ListOperationsRequest, - options?: gax.CallOptions - ): AsyncIterable { - return this.operationsClient.listOperationsAsync(request, options); - } - /** - * Starts asynchronous cancellation on a long-running operation. The server - * makes a best effort to cancel the operation, but success is not - * guaranteed. If the server doesn't support this method, it returns - * `google.rpc.Code.UNIMPLEMENTED`. Clients can use - * {@link Operations.GetOperation} or - * other methods to check whether the cancellation succeeded or whether the - * operation completed despite cancellation. On successful cancellation, - * the operation is not deleted; instead, it becomes an operation with - * an {@link Operation.error} value with a {@link google.rpc.Status.code} of - * 1, corresponding to `Code.CANCELLED`. - * - * @param {Object} request - The request object that will be sent. - * @param {string} request.name - The name of the operation resource to be cancelled. - * @param {Object=} options - * Optional parameters. You can override the default settings for this call, - * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link - * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the - * details. - * @param {function(?Error)=} callback - * The function which will be called with the result of the API call. - * @return {Promise} - The promise which resolves when API call finishes. - * The promise has a method named "cancel" which cancels the ongoing API - * call. - * - * @example - * ``` - * const client = longrunning.operationsClient(); - * await client.cancelOperation({name: ''}); - * ``` - */ - cancelOperation( - request: protos.google.longrunning.CancelOperationRequest, - options?: - | gax.CallOptions - | Callback< - protos.google.protobuf.Empty, - protos.google.longrunning.CancelOperationRequest, - {} | undefined | null - >, - callback?: Callback< - protos.google.longrunning.CancelOperationRequest, - protos.google.protobuf.Empty, - {} | undefined | null - > - ): Promise { - return this.operationsClient.cancelOperation(request, options, callback); - } - - /** - * Deletes a long-running operation. This method indicates that the client is - * no longer interested in the operation result. It does not cancel the - * operation. If the server doesn't support this method, it returns - * `google.rpc.Code.UNIMPLEMENTED`. - * - * @param {Object} request - The request object that will be sent. - * @param {string} request.name - The name of the operation resource to be deleted. - * @param {Object=} options - * Optional parameters. You can override the default settings for this call, - * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link - * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the - * details. - * @param {function(?Error)=} callback - * The function which will be called with the result of the API call. - * @return {Promise} - The promise which resolves when API call finishes. - * The promise has a method named "cancel" which cancels the ongoing API - * call. - * - * @example - * ``` - * const client = longrunning.operationsClient(); - * await client.deleteOperation({name: ''}); - * ``` - */ - deleteOperation( - request: protos.google.longrunning.DeleteOperationRequest, - options?: - | gax.CallOptions - | Callback< - protos.google.protobuf.Empty, - protos.google.longrunning.DeleteOperationRequest, - {} | null | undefined - >, - callback?: Callback< - protos.google.protobuf.Empty, - protos.google.longrunning.DeleteOperationRequest, - {} | null | undefined - > - ): Promise { - return this.operationsClient.deleteOperation(request, options, callback); - } - - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified hub resource name string. - * - * @param {string} project - * @param {string} hub - * @returns {string} Resource name string. - */ - hubPath(project: string, hub: string) { - return this.pathTemplates.hubPathTemplate.render({ - project: project, - hub: hub, - }); - } - - /** - * Parse the project from Hub resource. - * - * @param {string} hubName - * A fully-qualified path representing Hub resource. - * @returns {string} A string representing the project. - */ - matchProjectFromHubName(hubName: string) { - return this.pathTemplates.hubPathTemplate.match(hubName).project; - } - - /** - * Parse the hub from Hub resource. - * - * @param {string} hubName - * A fully-qualified path representing Hub resource. - * @returns {string} A string representing the hub. - */ - matchHubFromHubName(hubName: string) { - return this.pathTemplates.hubPathTemplate.match(hubName).hub; - } - - /** - * Return a fully-qualified location resource name string. - * - * @param {string} project - * @param {string} location - * @returns {string} Resource name string. - */ - locationPath(project: string, location: string) { - return this.pathTemplates.locationPathTemplate.render({ - project: project, - location: location, - }); - } - - /** - * Parse the project from Location resource. - * - * @param {string} locationName - * A fully-qualified path representing Location resource. - * @returns {string} A string representing the project. - */ - matchProjectFromLocationName(locationName: string) { - return this.pathTemplates.locationPathTemplate.match(locationName).project; - } - - /** - * Parse the location from Location resource. - * - * @param {string} locationName - * A fully-qualified path representing Location resource. - * @returns {string} A string representing the location. - */ - matchLocationFromLocationName(locationName: string) { - return this.pathTemplates.locationPathTemplate.match(locationName).location; - } - - /** - * Return a fully-qualified network resource name string. - * - * @param {string} project - * @param {string} resource_id - * @returns {string} Resource name string. - */ - networkPath(project: string, resourceId: string) { - return this.pathTemplates.networkPathTemplate.render({ - project: project, - resource_id: resourceId, - }); - } - - /** - * Parse the project from Network resource. - * - * @param {string} networkName - * A fully-qualified path representing Network resource. - * @returns {string} A string representing the project. - */ - matchProjectFromNetworkName(networkName: string) { - return this.pathTemplates.networkPathTemplate.match(networkName).project; - } - - /** - * Parse the resource_id from Network resource. - * - * @param {string} networkName - * A fully-qualified path representing Network resource. - * @returns {string} A string representing the resource_id. - */ - matchResourceIdFromNetworkName(networkName: string) { - return this.pathTemplates.networkPathTemplate.match(networkName) - .resource_id; - } - - /** - * Return a fully-qualified policyBasedRoute resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} policy_based_route - * @returns {string} Resource name string. - */ - policyBasedRoutePath( - project: string, - location: string, - policyBasedRoute: string - ) { - return this.pathTemplates.policyBasedRoutePathTemplate.render({ - project: project, - location: location, - policy_based_route: policyBasedRoute, - }); - } - - /** - * Parse the project from PolicyBasedRoute resource. - * - * @param {string} policyBasedRouteName - * A fully-qualified path representing PolicyBasedRoute resource. - * @returns {string} A string representing the project. - */ - matchProjectFromPolicyBasedRouteName(policyBasedRouteName: string) { - return this.pathTemplates.policyBasedRoutePathTemplate.match( - policyBasedRouteName - ).project; - } - - /** - * Parse the location from PolicyBasedRoute resource. - * - * @param {string} policyBasedRouteName - * A fully-qualified path representing PolicyBasedRoute resource. - * @returns {string} A string representing the location. - */ - matchLocationFromPolicyBasedRouteName(policyBasedRouteName: string) { - return this.pathTemplates.policyBasedRoutePathTemplate.match( - policyBasedRouteName - ).location; - } - - /** - * Parse the policy_based_route from PolicyBasedRoute resource. - * - * @param {string} policyBasedRouteName - * A fully-qualified path representing PolicyBasedRoute resource. - * @returns {string} A string representing the policy_based_route. - */ - matchPolicyBasedRouteFromPolicyBasedRouteName(policyBasedRouteName: string) { - return this.pathTemplates.policyBasedRoutePathTemplate.match( - policyBasedRouteName - ).policy_based_route; - } - - /** - * Return a fully-qualified spoke resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} spoke - * @returns {string} Resource name string. - */ - spokePath(project: string, location: string, spoke: string) { - return this.pathTemplates.spokePathTemplate.render({ - project: project, - location: location, - spoke: spoke, - }); - } - - /** - * Parse the project from Spoke resource. - * - * @param {string} spokeName - * A fully-qualified path representing Spoke resource. - * @returns {string} A string representing the project. - */ - matchProjectFromSpokeName(spokeName: string) { - return this.pathTemplates.spokePathTemplate.match(spokeName).project; - } - - /** - * Parse the location from Spoke resource. - * - * @param {string} spokeName - * A fully-qualified path representing Spoke resource. - * @returns {string} A string representing the location. - */ - matchLocationFromSpokeName(spokeName: string) { - return this.pathTemplates.spokePathTemplate.match(spokeName).location; - } - - /** - * Parse the spoke from Spoke resource. - * - * @param {string} spokeName - * A fully-qualified path representing Spoke resource. - * @returns {string} A string representing the spoke. - */ - matchSpokeFromSpokeName(spokeName: string) { - return this.pathTemplates.spokePathTemplate.match(spokeName).spoke; - } - - /** - * Terminate the gRPC channel and close the client. - * - * The client will no longer be usable and all future behavior is undefined. - * @returns {Promise} A promise that resolves when the client is closed. - */ - close(): Promise { - if (this.policyBasedRoutingServiceStub && !this._terminated) { - return this.policyBasedRoutingServiceStub.then(stub => { - this._terminated = true; - stub.close(); - this.iamClient.close(); - this.locationsClient.close(); - this.operationsClient.close(); - }); - } - return Promise.resolve(); - } -} diff --git a/packages/google-cloud-networkconnectivity/src/v1/policy_based_routing_service_client_config.json b/packages/google-cloud-networkconnectivity/src/v1/policy_based_routing_service_client_config.json deleted file mode 100644 index d204ef942c8..00000000000 --- a/packages/google-cloud-networkconnectivity/src/v1/policy_based_routing_service_client_config.json +++ /dev/null @@ -1,58 +0,0 @@ -{ - "interfaces": { - "google.cloud.networkconnectivity.v1.PolicyBasedRoutingService": { - "retry_codes": { - "non_idempotent": [], - "idempotent": [ - "DEADLINE_EXCEEDED", - "UNAVAILABLE" - ], - "unavailable": [ - "UNAVAILABLE" - ] - }, - "retry_params": { - "default": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - }, - "ce5b960a6ed052e690863808e4f0deff3dc7d49f": { - "initial_retry_delay_millis": 1000, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 10000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - } - }, - "methods": { - "ListPolicyBasedRoutes": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" - }, - "GetPolicyBasedRoute": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" - }, - "CreatePolicyBasedRoute": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "DeletePolicyBasedRoute": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - } - } - } - } -} diff --git a/packages/google-cloud-networkconnectivity/src/v1/policy_based_routing_service_proto_list.json b/packages/google-cloud-networkconnectivity/src/v1/policy_based_routing_service_proto_list.json deleted file mode 100644 index d076e60ee41..00000000000 --- a/packages/google-cloud-networkconnectivity/src/v1/policy_based_routing_service_proto_list.json +++ /dev/null @@ -1,5 +0,0 @@ -[ - "../../protos/google/cloud/networkconnectivity/v1/common.proto", - "../../protos/google/cloud/networkconnectivity/v1/hub.proto", - "../../protos/google/cloud/networkconnectivity/v1/policy_based_routing.proto" -] diff --git a/packages/google-cloud-networkconnectivity/system-test/fixtures/sample/src/index.js b/packages/google-cloud-networkconnectivity/system-test/fixtures/sample/src/index.js index 27c8430d34d..7f6ba4c79f7 100644 --- a/packages/google-cloud-networkconnectivity/system-test/fixtures/sample/src/index.js +++ b/packages/google-cloud-networkconnectivity/system-test/fixtures/sample/src/index.js @@ -21,8 +21,6 @@ const networkconnectivity = require('@google-cloud/network-connectivity'); function main() { const hubServiceClient = new networkconnectivity.HubServiceClient(); - const policyBasedRoutingServiceClient = - new networkconnectivity.PolicyBasedRoutingServiceClient(); } main(); diff --git a/packages/google-cloud-networkconnectivity/system-test/fixtures/sample/src/index.ts b/packages/google-cloud-networkconnectivity/system-test/fixtures/sample/src/index.ts index f2dc2964b5f..ae4d979ece8 100644 --- a/packages/google-cloud-networkconnectivity/system-test/fixtures/sample/src/index.ts +++ b/packages/google-cloud-networkconnectivity/system-test/fixtures/sample/src/index.ts @@ -16,28 +16,17 @@ // ** https://github.com/googleapis/gapic-generator-typescript ** // ** All changes to this file may be overwritten. ** -import { - HubServiceClient, - PolicyBasedRoutingServiceClient, -} from '@google-cloud/network-connectivity'; +import {HubServiceClient} from '@google-cloud/network-connectivity'; // check that the client class type name can be used function doStuffWithHubServiceClient(client: HubServiceClient) { client.close(); } -function doStuffWithPolicyBasedRoutingServiceClient( - client: PolicyBasedRoutingServiceClient -) { - client.close(); -} function main() { // check that the client instance can be created const hubServiceClient = new HubServiceClient(); doStuffWithHubServiceClient(hubServiceClient); - // check that the client instance can be created - const policyBasedRoutingServiceClient = new PolicyBasedRoutingServiceClient(); - doStuffWithPolicyBasedRoutingServiceClient(policyBasedRoutingServiceClient); } main(); diff --git a/packages/google-cloud-networkconnectivity/test/gapic_hub_service_v1.ts b/packages/google-cloud-networkconnectivity/test/gapic_hub_service_v1.ts index f192f930b61..1eaf9a445f1 100644 --- a/packages/google-cloud-networkconnectivity/test/gapic_hub_service_v1.ts +++ b/packages/google-cloud-networkconnectivity/test/gapic_hub_service_v1.ts @@ -25,13 +25,7 @@ import * as hubserviceModule from '../src'; import {PassThrough} from 'stream'; -import { - protobuf, - LROperation, - operationsProtos, - IamProtos, - LocationProtos, -} from 'google-gax'; +import {protobuf, LROperation, operationsProtos} from 'google-gax'; // Dynamically loaded proto JSON is needed to get the type information // to fill in default values for request objects @@ -2320,833 +2314,6 @@ describe('v1.HubServiceClient', () => { ); }); }); - describe('getIamPolicy', () => { - it('invokes getIamPolicy without error', async () => { - const client = new hubserviceModule.v1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.GetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.Policy() - ); - client.iamClient.getIamPolicy = stubSimpleCall(expectedResponse); - const response = await client.getIamPolicy(request, expectedOptions); - assert.deepStrictEqual(response, [expectedResponse]); - assert( - (client.iamClient.getIamPolicy as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); - }); - it('invokes getIamPolicy without error using callback', async () => { - const client = new hubserviceModule.v1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.GetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.Policy() - ); - client.iamClient.getIamPolicy = sinon - .stub() - .callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getIamPolicy( - request, - expectedOptions, - ( - err?: Error | null, - result?: IamProtos.google.iam.v1.Policy | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - } - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.iamClient.getIamPolicy as SinonStub).getCall(0)); - }); - it('invokes getIamPolicy with error', async () => { - const client = new hubserviceModule.v1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.GetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.iamClient.getIamPolicy = stubSimpleCall(undefined, expectedError); - await assert.rejects( - client.getIamPolicy(request, expectedOptions), - expectedError - ); - assert( - (client.iamClient.getIamPolicy as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); - }); - }); - describe('setIamPolicy', () => { - it('invokes setIamPolicy without error', async () => { - const client = new hubserviceModule.v1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.SetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.Policy() - ); - client.iamClient.setIamPolicy = stubSimpleCall(expectedResponse); - const response = await client.setIamPolicy(request, expectedOptions); - assert.deepStrictEqual(response, [expectedResponse]); - assert( - (client.iamClient.setIamPolicy as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); - }); - it('invokes setIamPolicy without error using callback', async () => { - const client = new hubserviceModule.v1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.SetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.Policy() - ); - client.iamClient.setIamPolicy = sinon - .stub() - .callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.setIamPolicy( - request, - expectedOptions, - ( - err?: Error | null, - result?: IamProtos.google.iam.v1.Policy | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - } - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.iamClient.setIamPolicy as SinonStub).getCall(0)); - }); - it('invokes setIamPolicy with error', async () => { - const client = new hubserviceModule.v1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.SetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.iamClient.setIamPolicy = stubSimpleCall(undefined, expectedError); - await assert.rejects( - client.setIamPolicy(request, expectedOptions), - expectedError - ); - assert( - (client.iamClient.setIamPolicy as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); - }); - }); - describe('testIamPermissions', () => { - it('invokes testIamPermissions without error', async () => { - const client = new hubserviceModule.v1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.TestIamPermissionsRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.TestIamPermissionsResponse() - ); - client.iamClient.testIamPermissions = stubSimpleCall(expectedResponse); - const response = await client.testIamPermissions( - request, - expectedOptions - ); - assert.deepStrictEqual(response, [expectedResponse]); - assert( - (client.iamClient.testIamPermissions as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); - }); - it('invokes testIamPermissions without error using callback', async () => { - const client = new hubserviceModule.v1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.TestIamPermissionsRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.TestIamPermissionsResponse() - ); - client.iamClient.testIamPermissions = sinon - .stub() - .callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.testIamPermissions( - request, - expectedOptions, - ( - err?: Error | null, - result?: IamProtos.google.iam.v1.TestIamPermissionsResponse | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - } - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.iamClient.testIamPermissions as SinonStub).getCall(0)); - }); - it('invokes testIamPermissions with error', async () => { - const client = new hubserviceModule.v1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.TestIamPermissionsRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.iamClient.testIamPermissions = stubSimpleCall( - undefined, - expectedError - ); - await assert.rejects( - client.testIamPermissions(request, expectedOptions), - expectedError - ); - assert( - (client.iamClient.testIamPermissions as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); - }); - }); - describe('getLocation', () => { - it('invokes getLocation without error', async () => { - const client = new hubserviceModule.v1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ); - client.locationsClient.getLocation = stubSimpleCall(expectedResponse); - const response = await client.getLocation(request, expectedOptions); - assert.deepStrictEqual(response, [expectedResponse]); - assert( - (client.locationsClient.getLocation as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); - }); - it('invokes getLocation without error using callback', async () => { - const client = new hubserviceModule.v1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ); - client.locationsClient.getLocation = sinon - .stub() - .callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getLocation( - request, - expectedOptions, - ( - err?: Error | null, - result?: LocationProtos.google.cloud.location.ILocation | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - } - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.locationsClient.getLocation as SinonStub).getCall(0)); - }); - it('invokes getLocation with error', async () => { - const client = new hubserviceModule.v1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.locationsClient.getLocation = stubSimpleCall( - undefined, - expectedError - ); - await assert.rejects( - client.getLocation(request, expectedOptions), - expectedError - ); - assert( - (client.locationsClient.getLocation as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); - }); - }); - describe('listLocationsAsync', () => { - it('uses async iteration with listLocations without error', async () => { - const client = new hubserviceModule.v1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.ListLocationsRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedResponse = [ - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - ]; - client.locationsClient.descriptors.page.listLocations.asyncIterate = - stubAsyncIterationCall(expectedResponse); - const responses: LocationProtos.google.cloud.location.ILocation[] = []; - const iterable = client.listLocationsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - ( - client.locationsClient.descriptors.page.listLocations - .asyncIterate as SinonStub - ).getCall(0).args[1], - request - ); - assert( - ( - client.locationsClient.descriptors.page.listLocations - .asyncIterate as SinonStub - ) - .getCall(0) - .args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - it('uses async iteration with listLocations with error', async () => { - const client = new hubserviceModule.v1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.ListLocationsRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedError = new Error('expected'); - client.locationsClient.descriptors.page.listLocations.asyncIterate = - stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listLocationsAsync(request); - await assert.rejects(async () => { - const responses: LocationProtos.google.cloud.location.ILocation[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - ( - client.locationsClient.descriptors.page.listLocations - .asyncIterate as SinonStub - ).getCall(0).args[1], - request - ); - assert( - ( - client.locationsClient.descriptors.page.listLocations - .asyncIterate as SinonStub - ) - .getCall(0) - .args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - describe('getOperation', () => { - it('invokes getOperation without error', async () => { - const client = new hubserviceModule.v1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.GetOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const response = await client.getOperation(request); - assert.deepStrictEqual(response, [expectedResponse]); - assert( - (client.operationsClient.getOperation as SinonStub) - .getCall(0) - .calledWith(request) - ); - }); - it('invokes getOperation without error using callback', async () => { - const client = new hubserviceModule.v1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.GetOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - client.operationsClient.getOperation = sinon - .stub() - .callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.operationsClient.getOperation( - request, - undefined, - ( - err?: Error | null, - result?: operationsProtos.google.longrunning.Operation | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - } - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - it('invokes getOperation with error', async () => { - const client = new hubserviceModule.v1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.GetOperationRequest() - ); - const expectedError = new Error('expected'); - client.operationsClient.getOperation = stubSimpleCall( - undefined, - expectedError - ); - await assert.rejects(async () => { - await client.getOperation(request); - }, expectedError); - assert( - (client.operationsClient.getOperation as SinonStub) - .getCall(0) - .calledWith(request) - ); - }); - }); - describe('cancelOperation', () => { - it('invokes cancelOperation without error', async () => { - const client = new hubserviceModule.v1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.CancelOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.operationsClient.cancelOperation = - stubSimpleCall(expectedResponse); - const response = await client.cancelOperation(request); - assert.deepStrictEqual(response, [expectedResponse]); - assert( - (client.operationsClient.cancelOperation as SinonStub) - .getCall(0) - .calledWith(request) - ); - }); - it('invokes cancelOperation without error using callback', async () => { - const client = new hubserviceModule.v1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.CancelOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.operationsClient.cancelOperation = sinon - .stub() - .callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.operationsClient.cancelOperation( - request, - undefined, - ( - err?: Error | null, - result?: protos.google.protobuf.Empty | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - } - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.operationsClient.cancelOperation as SinonStub).getCall(0)); - }); - it('invokes cancelOperation with error', async () => { - const client = new hubserviceModule.v1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.CancelOperationRequest() - ); - const expectedError = new Error('expected'); - client.operationsClient.cancelOperation = stubSimpleCall( - undefined, - expectedError - ); - await assert.rejects(async () => { - await client.cancelOperation(request); - }, expectedError); - assert( - (client.operationsClient.cancelOperation as SinonStub) - .getCall(0) - .calledWith(request) - ); - }); - }); - describe('deleteOperation', () => { - it('invokes deleteOperation without error', async () => { - const client = new hubserviceModule.v1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.DeleteOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.operationsClient.deleteOperation = - stubSimpleCall(expectedResponse); - const response = await client.deleteOperation(request); - assert.deepStrictEqual(response, [expectedResponse]); - assert( - (client.operationsClient.deleteOperation as SinonStub) - .getCall(0) - .calledWith(request) - ); - }); - it('invokes deleteOperation without error using callback', async () => { - const client = new hubserviceModule.v1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.DeleteOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.operationsClient.deleteOperation = sinon - .stub() - .callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.operationsClient.deleteOperation( - request, - undefined, - ( - err?: Error | null, - result?: protos.google.protobuf.Empty | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - } - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.operationsClient.deleteOperation as SinonStub).getCall(0)); - }); - it('invokes deleteOperation with error', async () => { - const client = new hubserviceModule.v1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.DeleteOperationRequest() - ); - const expectedError = new Error('expected'); - client.operationsClient.deleteOperation = stubSimpleCall( - undefined, - expectedError - ); - await assert.rejects(async () => { - await client.deleteOperation(request); - }, expectedError); - assert( - (client.operationsClient.deleteOperation as SinonStub) - .getCall(0) - .calledWith(request) - ); - }); - }); - describe('listOperationsAsync', () => { - it('uses async iteration with listOperations without error', async () => { - const client = new hubserviceModule.v1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsRequest() - ); - const expectedResponse = [ - generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsResponse() - ), - generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsResponse() - ), - generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsResponse() - ), - ]; - client.operationsClient.descriptor.listOperations.asyncIterate = - stubAsyncIterationCall(expectedResponse); - const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = - []; - const iterable = client.operationsClient.listOperationsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - ( - client.operationsClient.descriptor.listOperations - .asyncIterate as SinonStub - ).getCall(0).args[1], - request - ); - }); - it('uses async iteration with listOperations with error', async () => { - const client = new hubserviceModule.v1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsRequest() - ); - const expectedError = new Error('expected'); - client.operationsClient.descriptor.listOperations.asyncIterate = - stubAsyncIterationCall(undefined, expectedError); - const iterable = client.operationsClient.listOperationsAsync(request); - await assert.rejects(async () => { - const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = - []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - ( - client.operationsClient.descriptor.listOperations - .asyncIterate as SinonStub - ).getCall(0).args[1], - request - ); - }); - }); describe('Path templates', () => { describe('hub', () => { @@ -3439,74 +2606,6 @@ describe('v1.HubServiceClient', () => { }); }); - describe('policyBasedRoute', () => { - const fakePath = '/rendered/path/policyBasedRoute'; - const expectedParameters = { - project: 'projectValue', - location: 'locationValue', - policy_based_route: 'policyBasedRouteValue', - }; - const client = new hubserviceModule.v1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.policyBasedRoutePathTemplate.render = sinon - .stub() - .returns(fakePath); - client.pathTemplates.policyBasedRoutePathTemplate.match = sinon - .stub() - .returns(expectedParameters); - - it('policyBasedRoutePath', () => { - const result = client.policyBasedRoutePath( - 'projectValue', - 'locationValue', - 'policyBasedRouteValue' - ); - assert.strictEqual(result, fakePath); - assert( - ( - client.pathTemplates.policyBasedRoutePathTemplate - .render as SinonStub - ) - .getCall(-1) - .calledWith(expectedParameters) - ); - }); - - it('matchProjectFromPolicyBasedRouteName', () => { - const result = client.matchProjectFromPolicyBasedRouteName(fakePath); - assert.strictEqual(result, 'projectValue'); - assert( - (client.pathTemplates.policyBasedRoutePathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath) - ); - }); - - it('matchLocationFromPolicyBasedRouteName', () => { - const result = client.matchLocationFromPolicyBasedRouteName(fakePath); - assert.strictEqual(result, 'locationValue'); - assert( - (client.pathTemplates.policyBasedRoutePathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath) - ); - }); - - it('matchPolicyBasedRouteFromPolicyBasedRouteName', () => { - const result = - client.matchPolicyBasedRouteFromPolicyBasedRouteName(fakePath); - assert.strictEqual(result, 'policyBasedRouteValue'); - assert( - (client.pathTemplates.policyBasedRoutePathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath) - ); - }); - }); - describe('spoke', () => { const fakePath = '/rendered/path/spoke'; const expectedParameters = { diff --git a/packages/google-cloud-networkconnectivity/test/gapic_policy_based_routing_service_v1.ts b/packages/google-cloud-networkconnectivity/test/gapic_policy_based_routing_service_v1.ts deleted file mode 100644 index 01ca79a0d02..00000000000 --- a/packages/google-cloud-networkconnectivity/test/gapic_policy_based_routing_service_v1.ts +++ /dev/null @@ -1,2322 +0,0 @@ -// Copyright 2023 Google LLC -// -// 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 -// -// https://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. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -import * as protos from '../protos/protos'; -import * as assert from 'assert'; -import * as sinon from 'sinon'; -import {SinonStub} from 'sinon'; -import {describe, it} from 'mocha'; -import * as policybasedroutingserviceModule from '../src'; - -import {PassThrough} from 'stream'; - -import { - protobuf, - LROperation, - operationsProtos, - IamProtos, - LocationProtos, -} from 'google-gax'; - -// Dynamically loaded proto JSON is needed to get the type information -// to fill in default values for request objects -const root = protobuf.Root.fromJSON( - require('../protos/protos.json') -).resolveAll(); - -// eslint-disable-next-line @typescript-eslint/no-unused-vars -function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type.fields[field]?.resolvedType as protobuf.Type; - } - return type.fields[fields[fields.length - 1]]?.defaultValue; -} - -function generateSampleMessage(instance: T) { - const filledObject = ( - instance.constructor as typeof protobuf.Message - ).toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject( - filledObject - ) as T; -} - -function stubSimpleCall(response?: ResponseType, error?: Error) { - return error - ? sinon.stub().rejects(error) - : sinon.stub().resolves([response]); -} - -function stubSimpleCallWithCallback( - response?: ResponseType, - error?: Error -) { - return error - ? sinon.stub().callsArgWith(2, error) - : sinon.stub().callsArgWith(2, null, response); -} - -function stubLongRunningCall( - response?: ResponseType, - callError?: Error, - lroError?: Error -) { - const innerStub = lroError - ? sinon.stub().rejects(lroError) - : sinon.stub().resolves([response]); - const mockOperation = { - promise: innerStub, - }; - return callError - ? sinon.stub().rejects(callError) - : sinon.stub().resolves([mockOperation]); -} - -function stubLongRunningCallWithCallback( - response?: ResponseType, - callError?: Error, - lroError?: Error -) { - const innerStub = lroError - ? sinon.stub().rejects(lroError) - : sinon.stub().resolves([response]); - const mockOperation = { - promise: innerStub, - }; - return callError - ? sinon.stub().callsArgWith(2, callError) - : sinon.stub().callsArgWith(2, null, mockOperation); -} - -function stubPageStreamingCall( - responses?: ResponseType[], - error?: Error -) { - const pagingStub = sinon.stub(); - if (responses) { - for (let i = 0; i < responses.length; ++i) { - pagingStub.onCall(i).callsArgWith(2, null, responses[i]); - } - } - const transformStub = error - ? sinon.stub().callsArgWith(2, error) - : pagingStub; - const mockStream = new PassThrough({ - objectMode: true, - transform: transformStub, - }); - // trigger as many responses as needed - if (responses) { - for (let i = 0; i < responses.length; ++i) { - setImmediate(() => { - mockStream.write({}); - }); - } - setImmediate(() => { - mockStream.end(); - }); - } else { - setImmediate(() => { - mockStream.write({}); - }); - setImmediate(() => { - mockStream.end(); - }); - } - return sinon.stub().returns(mockStream); -} - -function stubAsyncIterationCall( - responses?: ResponseType[], - error?: Error -) { - let counter = 0; - const asyncIterable = { - [Symbol.asyncIterator]() { - return { - async next() { - if (error) { - return Promise.reject(error); - } - if (counter >= responses!.length) { - return Promise.resolve({done: true, value: undefined}); - } - return Promise.resolve({done: false, value: responses![counter++]}); - }, - }; - }, - }; - return sinon.stub().returns(asyncIterable); -} - -describe('v1.PolicyBasedRoutingServiceClient', () => { - describe('Common methods', () => { - it('has servicePath', () => { - const servicePath = - policybasedroutingserviceModule.v1.PolicyBasedRoutingServiceClient - .servicePath; - assert(servicePath); - }); - - it('has apiEndpoint', () => { - const apiEndpoint = - policybasedroutingserviceModule.v1.PolicyBasedRoutingServiceClient - .apiEndpoint; - assert(apiEndpoint); - }); - - it('has port', () => { - const port = - policybasedroutingserviceModule.v1.PolicyBasedRoutingServiceClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = - new policybasedroutingserviceModule.v1.PolicyBasedRoutingServiceClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = - new policybasedroutingserviceModule.v1.PolicyBasedRoutingServiceClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = - new policybasedroutingserviceModule.v1.PolicyBasedRoutingServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.policyBasedRoutingServiceStub, undefined); - await client.initialize(); - assert(client.policyBasedRoutingServiceStub); - }); - - it('has close method for the initialized client', done => { - const client = - new policybasedroutingserviceModule.v1.PolicyBasedRoutingServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - assert(client.policyBasedRoutingServiceStub); - client.close().then(() => { - done(); - }); - }); - - it('has close method for the non-initialized client', done => { - const client = - new policybasedroutingserviceModule.v1.PolicyBasedRoutingServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.policyBasedRoutingServiceStub, undefined); - client.close().then(() => { - done(); - }); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = - new policybasedroutingserviceModule.v1.PolicyBasedRoutingServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); - }); - - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = - new policybasedroutingserviceModule.v1.PolicyBasedRoutingServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon - .stub() - .callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error | null, projectId?: string | null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); - }); - }); - - describe('getPolicyBasedRoute', () => { - it('invokes getPolicyBasedRoute without error', async () => { - const client = - new policybasedroutingserviceModule.v1.PolicyBasedRoutingServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networkconnectivity.v1.GetPolicyBasedRouteRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.networkconnectivity.v1.GetPolicyBasedRouteRequest', - ['name'] - ); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.networkconnectivity.v1.PolicyBasedRoute() - ); - client.innerApiCalls.getPolicyBasedRoute = - stubSimpleCall(expectedResponse); - const [response] = await client.getPolicyBasedRoute(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.getPolicyBasedRoute as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.getPolicyBasedRoute as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getPolicyBasedRoute without error using callback', async () => { - const client = - new policybasedroutingserviceModule.v1.PolicyBasedRoutingServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networkconnectivity.v1.GetPolicyBasedRouteRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.networkconnectivity.v1.GetPolicyBasedRouteRequest', - ['name'] - ); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.networkconnectivity.v1.PolicyBasedRoute() - ); - client.innerApiCalls.getPolicyBasedRoute = - stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getPolicyBasedRoute( - request, - ( - err?: Error | null, - result?: protos.google.cloud.networkconnectivity.v1.IPolicyBasedRoute | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - } - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.getPolicyBasedRoute as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.getPolicyBasedRoute as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getPolicyBasedRoute with error', async () => { - const client = - new policybasedroutingserviceModule.v1.PolicyBasedRoutingServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networkconnectivity.v1.GetPolicyBasedRouteRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.networkconnectivity.v1.GetPolicyBasedRouteRequest', - ['name'] - ); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getPolicyBasedRoute = stubSimpleCall( - undefined, - expectedError - ); - await assert.rejects(client.getPolicyBasedRoute(request), expectedError); - const actualRequest = ( - client.innerApiCalls.getPolicyBasedRoute as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.getPolicyBasedRoute as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getPolicyBasedRoute with closed client', async () => { - const client = - new policybasedroutingserviceModule.v1.PolicyBasedRoutingServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networkconnectivity.v1.GetPolicyBasedRouteRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.networkconnectivity.v1.GetPolicyBasedRouteRequest', - ['name'] - ); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getPolicyBasedRoute(request), expectedError); - }); - }); - - describe('createPolicyBasedRoute', () => { - it('invokes createPolicyBasedRoute without error', async () => { - const client = - new policybasedroutingserviceModule.v1.PolicyBasedRoutingServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networkconnectivity.v1.CreatePolicyBasedRouteRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.networkconnectivity.v1.CreatePolicyBasedRouteRequest', - ['parent'] - ); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createPolicyBasedRoute = - stubLongRunningCall(expectedResponse); - const [operation] = await client.createPolicyBasedRoute(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.createPolicyBasedRoute as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.createPolicyBasedRoute as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createPolicyBasedRoute without error using callback', async () => { - const client = - new policybasedroutingserviceModule.v1.PolicyBasedRoutingServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networkconnectivity.v1.CreatePolicyBasedRouteRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.networkconnectivity.v1.CreatePolicyBasedRouteRequest', - ['parent'] - ); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createPolicyBasedRoute = - stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createPolicyBasedRoute( - request, - ( - err?: Error | null, - result?: LROperation< - protos.google.cloud.networkconnectivity.v1.IPolicyBasedRoute, - protos.google.cloud.networkconnectivity.v1.IOperationMetadata - > | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - } - ); - }); - const operation = (await promise) as LROperation< - protos.google.cloud.networkconnectivity.v1.IPolicyBasedRoute, - protos.google.cloud.networkconnectivity.v1.IOperationMetadata - >; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.createPolicyBasedRoute as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.createPolicyBasedRoute as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createPolicyBasedRoute with call error', async () => { - const client = - new policybasedroutingserviceModule.v1.PolicyBasedRoutingServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networkconnectivity.v1.CreatePolicyBasedRouteRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.networkconnectivity.v1.CreatePolicyBasedRouteRequest', - ['parent'] - ); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createPolicyBasedRoute = stubLongRunningCall( - undefined, - expectedError - ); - await assert.rejects( - client.createPolicyBasedRoute(request), - expectedError - ); - const actualRequest = ( - client.innerApiCalls.createPolicyBasedRoute as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.createPolicyBasedRoute as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createPolicyBasedRoute with LRO error', async () => { - const client = - new policybasedroutingserviceModule.v1.PolicyBasedRoutingServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networkconnectivity.v1.CreatePolicyBasedRouteRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.networkconnectivity.v1.CreatePolicyBasedRouteRequest', - ['parent'] - ); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createPolicyBasedRoute = stubLongRunningCall( - undefined, - undefined, - expectedError - ); - const [operation] = await client.createPolicyBasedRoute(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = ( - client.innerApiCalls.createPolicyBasedRoute as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.createPolicyBasedRoute as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkCreatePolicyBasedRouteProgress without error', async () => { - const client = - new policybasedroutingserviceModule.v1.PolicyBasedRoutingServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')}; - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkCreatePolicyBasedRouteProgress( - expectedResponse.name - ); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkCreatePolicyBasedRouteProgress with error', async () => { - const client = - new policybasedroutingserviceModule.v1.PolicyBasedRoutingServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall( - undefined, - expectedError - ); - await assert.rejects( - client.checkCreatePolicyBasedRouteProgress(''), - expectedError - ); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - }); - - describe('deletePolicyBasedRoute', () => { - it('invokes deletePolicyBasedRoute without error', async () => { - const client = - new policybasedroutingserviceModule.v1.PolicyBasedRoutingServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networkconnectivity.v1.DeletePolicyBasedRouteRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.networkconnectivity.v1.DeletePolicyBasedRouteRequest', - ['name'] - ); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deletePolicyBasedRoute = - stubLongRunningCall(expectedResponse); - const [operation] = await client.deletePolicyBasedRoute(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.deletePolicyBasedRoute as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.deletePolicyBasedRoute as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deletePolicyBasedRoute without error using callback', async () => { - const client = - new policybasedroutingserviceModule.v1.PolicyBasedRoutingServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networkconnectivity.v1.DeletePolicyBasedRouteRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.networkconnectivity.v1.DeletePolicyBasedRouteRequest', - ['name'] - ); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deletePolicyBasedRoute = - stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deletePolicyBasedRoute( - request, - ( - err?: Error | null, - result?: LROperation< - protos.google.protobuf.IEmpty, - protos.google.cloud.networkconnectivity.v1.IOperationMetadata - > | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - } - ); - }); - const operation = (await promise) as LROperation< - protos.google.protobuf.IEmpty, - protos.google.cloud.networkconnectivity.v1.IOperationMetadata - >; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.deletePolicyBasedRoute as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.deletePolicyBasedRoute as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deletePolicyBasedRoute with call error', async () => { - const client = - new policybasedroutingserviceModule.v1.PolicyBasedRoutingServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networkconnectivity.v1.DeletePolicyBasedRouteRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.networkconnectivity.v1.DeletePolicyBasedRouteRequest', - ['name'] - ); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deletePolicyBasedRoute = stubLongRunningCall( - undefined, - expectedError - ); - await assert.rejects( - client.deletePolicyBasedRoute(request), - expectedError - ); - const actualRequest = ( - client.innerApiCalls.deletePolicyBasedRoute as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.deletePolicyBasedRoute as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deletePolicyBasedRoute with LRO error', async () => { - const client = - new policybasedroutingserviceModule.v1.PolicyBasedRoutingServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networkconnectivity.v1.DeletePolicyBasedRouteRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.networkconnectivity.v1.DeletePolicyBasedRouteRequest', - ['name'] - ); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deletePolicyBasedRoute = stubLongRunningCall( - undefined, - undefined, - expectedError - ); - const [operation] = await client.deletePolicyBasedRoute(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = ( - client.innerApiCalls.deletePolicyBasedRoute as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.deletePolicyBasedRoute as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkDeletePolicyBasedRouteProgress without error', async () => { - const client = - new policybasedroutingserviceModule.v1.PolicyBasedRoutingServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')}; - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkDeletePolicyBasedRouteProgress( - expectedResponse.name - ); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkDeletePolicyBasedRouteProgress with error', async () => { - const client = - new policybasedroutingserviceModule.v1.PolicyBasedRoutingServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall( - undefined, - expectedError - ); - await assert.rejects( - client.checkDeletePolicyBasedRouteProgress(''), - expectedError - ); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - }); - - describe('listPolicyBasedRoutes', () => { - it('invokes listPolicyBasedRoutes without error', async () => { - const client = - new policybasedroutingserviceModule.v1.PolicyBasedRoutingServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networkconnectivity.v1.ListPolicyBasedRoutesRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.networkconnectivity.v1.ListPolicyBasedRoutesRequest', - ['parent'] - ); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage( - new protos.google.cloud.networkconnectivity.v1.PolicyBasedRoute() - ), - generateSampleMessage( - new protos.google.cloud.networkconnectivity.v1.PolicyBasedRoute() - ), - generateSampleMessage( - new protos.google.cloud.networkconnectivity.v1.PolicyBasedRoute() - ), - ]; - client.innerApiCalls.listPolicyBasedRoutes = - stubSimpleCall(expectedResponse); - const [response] = await client.listPolicyBasedRoutes(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.listPolicyBasedRoutes as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.listPolicyBasedRoutes as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listPolicyBasedRoutes without error using callback', async () => { - const client = - new policybasedroutingserviceModule.v1.PolicyBasedRoutingServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networkconnectivity.v1.ListPolicyBasedRoutesRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.networkconnectivity.v1.ListPolicyBasedRoutesRequest', - ['parent'] - ); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage( - new protos.google.cloud.networkconnectivity.v1.PolicyBasedRoute() - ), - generateSampleMessage( - new protos.google.cloud.networkconnectivity.v1.PolicyBasedRoute() - ), - generateSampleMessage( - new protos.google.cloud.networkconnectivity.v1.PolicyBasedRoute() - ), - ]; - client.innerApiCalls.listPolicyBasedRoutes = - stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listPolicyBasedRoutes( - request, - ( - err?: Error | null, - result?: - | protos.google.cloud.networkconnectivity.v1.IPolicyBasedRoute[] - | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - } - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.listPolicyBasedRoutes as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.listPolicyBasedRoutes as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listPolicyBasedRoutes with error', async () => { - const client = - new policybasedroutingserviceModule.v1.PolicyBasedRoutingServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networkconnectivity.v1.ListPolicyBasedRoutesRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.networkconnectivity.v1.ListPolicyBasedRoutesRequest', - ['parent'] - ); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listPolicyBasedRoutes = stubSimpleCall( - undefined, - expectedError - ); - await assert.rejects( - client.listPolicyBasedRoutes(request), - expectedError - ); - const actualRequest = ( - client.innerApiCalls.listPolicyBasedRoutes as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.listPolicyBasedRoutes as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listPolicyBasedRoutesStream without error', async () => { - const client = - new policybasedroutingserviceModule.v1.PolicyBasedRoutingServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networkconnectivity.v1.ListPolicyBasedRoutesRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.networkconnectivity.v1.ListPolicyBasedRoutesRequest', - ['parent'] - ); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage( - new protos.google.cloud.networkconnectivity.v1.PolicyBasedRoute() - ), - generateSampleMessage( - new protos.google.cloud.networkconnectivity.v1.PolicyBasedRoute() - ), - generateSampleMessage( - new protos.google.cloud.networkconnectivity.v1.PolicyBasedRoute() - ), - ]; - client.descriptors.page.listPolicyBasedRoutes.createStream = - stubPageStreamingCall(expectedResponse); - const stream = client.listPolicyBasedRoutesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.networkconnectivity.v1.PolicyBasedRoute[] = - []; - stream.on( - 'data', - ( - response: protos.google.cloud.networkconnectivity.v1.PolicyBasedRoute - ) => { - responses.push(response); - } - ); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert( - ( - client.descriptors.page.listPolicyBasedRoutes - .createStream as SinonStub - ) - .getCall(0) - .calledWith(client.innerApiCalls.listPolicyBasedRoutes, request) - ); - assert( - ( - client.descriptors.page.listPolicyBasedRoutes - .createStream as SinonStub - ) - .getCall(0) - .args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listPolicyBasedRoutesStream with error', async () => { - const client = - new policybasedroutingserviceModule.v1.PolicyBasedRoutingServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networkconnectivity.v1.ListPolicyBasedRoutesRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.networkconnectivity.v1.ListPolicyBasedRoutesRequest', - ['parent'] - ); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listPolicyBasedRoutes.createStream = - stubPageStreamingCall(undefined, expectedError); - const stream = client.listPolicyBasedRoutesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.networkconnectivity.v1.PolicyBasedRoute[] = - []; - stream.on( - 'data', - ( - response: protos.google.cloud.networkconnectivity.v1.PolicyBasedRoute - ) => { - responses.push(response); - } - ); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert( - ( - client.descriptors.page.listPolicyBasedRoutes - .createStream as SinonStub - ) - .getCall(0) - .calledWith(client.innerApiCalls.listPolicyBasedRoutes, request) - ); - assert( - ( - client.descriptors.page.listPolicyBasedRoutes - .createStream as SinonStub - ) - .getCall(0) - .args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listPolicyBasedRoutes without error', async () => { - const client = - new policybasedroutingserviceModule.v1.PolicyBasedRoutingServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networkconnectivity.v1.ListPolicyBasedRoutesRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.networkconnectivity.v1.ListPolicyBasedRoutesRequest', - ['parent'] - ); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage( - new protos.google.cloud.networkconnectivity.v1.PolicyBasedRoute() - ), - generateSampleMessage( - new protos.google.cloud.networkconnectivity.v1.PolicyBasedRoute() - ), - generateSampleMessage( - new protos.google.cloud.networkconnectivity.v1.PolicyBasedRoute() - ), - ]; - client.descriptors.page.listPolicyBasedRoutes.asyncIterate = - stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.networkconnectivity.v1.IPolicyBasedRoute[] = - []; - const iterable = client.listPolicyBasedRoutesAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - ( - client.descriptors.page.listPolicyBasedRoutes - .asyncIterate as SinonStub - ).getCall(0).args[1], - request - ); - assert( - ( - client.descriptors.page.listPolicyBasedRoutes - .asyncIterate as SinonStub - ) - .getCall(0) - .args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listPolicyBasedRoutes with error', async () => { - const client = - new policybasedroutingserviceModule.v1.PolicyBasedRoutingServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.networkconnectivity.v1.ListPolicyBasedRoutesRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.networkconnectivity.v1.ListPolicyBasedRoutesRequest', - ['parent'] - ); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listPolicyBasedRoutes.asyncIterate = - stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listPolicyBasedRoutesAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.networkconnectivity.v1.IPolicyBasedRoute[] = - []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - ( - client.descriptors.page.listPolicyBasedRoutes - .asyncIterate as SinonStub - ).getCall(0).args[1], - request - ); - assert( - ( - client.descriptors.page.listPolicyBasedRoutes - .asyncIterate as SinonStub - ) - .getCall(0) - .args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - describe('getIamPolicy', () => { - it('invokes getIamPolicy without error', async () => { - const client = - new policybasedroutingserviceModule.v1.PolicyBasedRoutingServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.GetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.Policy() - ); - client.iamClient.getIamPolicy = stubSimpleCall(expectedResponse); - const response = await client.getIamPolicy(request, expectedOptions); - assert.deepStrictEqual(response, [expectedResponse]); - assert( - (client.iamClient.getIamPolicy as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); - }); - it('invokes getIamPolicy without error using callback', async () => { - const client = - new policybasedroutingserviceModule.v1.PolicyBasedRoutingServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.GetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.Policy() - ); - client.iamClient.getIamPolicy = sinon - .stub() - .callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getIamPolicy( - request, - expectedOptions, - ( - err?: Error | null, - result?: IamProtos.google.iam.v1.Policy | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - } - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.iamClient.getIamPolicy as SinonStub).getCall(0)); - }); - it('invokes getIamPolicy with error', async () => { - const client = - new policybasedroutingserviceModule.v1.PolicyBasedRoutingServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.GetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.iamClient.getIamPolicy = stubSimpleCall(undefined, expectedError); - await assert.rejects( - client.getIamPolicy(request, expectedOptions), - expectedError - ); - assert( - (client.iamClient.getIamPolicy as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); - }); - }); - describe('setIamPolicy', () => { - it('invokes setIamPolicy without error', async () => { - const client = - new policybasedroutingserviceModule.v1.PolicyBasedRoutingServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.SetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.Policy() - ); - client.iamClient.setIamPolicy = stubSimpleCall(expectedResponse); - const response = await client.setIamPolicy(request, expectedOptions); - assert.deepStrictEqual(response, [expectedResponse]); - assert( - (client.iamClient.setIamPolicy as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); - }); - it('invokes setIamPolicy without error using callback', async () => { - const client = - new policybasedroutingserviceModule.v1.PolicyBasedRoutingServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.SetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.Policy() - ); - client.iamClient.setIamPolicy = sinon - .stub() - .callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.setIamPolicy( - request, - expectedOptions, - ( - err?: Error | null, - result?: IamProtos.google.iam.v1.Policy | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - } - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.iamClient.setIamPolicy as SinonStub).getCall(0)); - }); - it('invokes setIamPolicy with error', async () => { - const client = - new policybasedroutingserviceModule.v1.PolicyBasedRoutingServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.SetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.iamClient.setIamPolicy = stubSimpleCall(undefined, expectedError); - await assert.rejects( - client.setIamPolicy(request, expectedOptions), - expectedError - ); - assert( - (client.iamClient.setIamPolicy as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); - }); - }); - describe('testIamPermissions', () => { - it('invokes testIamPermissions without error', async () => { - const client = - new policybasedroutingserviceModule.v1.PolicyBasedRoutingServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.TestIamPermissionsRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.TestIamPermissionsResponse() - ); - client.iamClient.testIamPermissions = stubSimpleCall(expectedResponse); - const response = await client.testIamPermissions( - request, - expectedOptions - ); - assert.deepStrictEqual(response, [expectedResponse]); - assert( - (client.iamClient.testIamPermissions as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); - }); - it('invokes testIamPermissions without error using callback', async () => { - const client = - new policybasedroutingserviceModule.v1.PolicyBasedRoutingServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.TestIamPermissionsRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.TestIamPermissionsResponse() - ); - client.iamClient.testIamPermissions = sinon - .stub() - .callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.testIamPermissions( - request, - expectedOptions, - ( - err?: Error | null, - result?: IamProtos.google.iam.v1.TestIamPermissionsResponse | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - } - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.iamClient.testIamPermissions as SinonStub).getCall(0)); - }); - it('invokes testIamPermissions with error', async () => { - const client = - new policybasedroutingserviceModule.v1.PolicyBasedRoutingServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.TestIamPermissionsRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.iamClient.testIamPermissions = stubSimpleCall( - undefined, - expectedError - ); - await assert.rejects( - client.testIamPermissions(request, expectedOptions), - expectedError - ); - assert( - (client.iamClient.testIamPermissions as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); - }); - }); - describe('getLocation', () => { - it('invokes getLocation without error', async () => { - const client = - new policybasedroutingserviceModule.v1.PolicyBasedRoutingServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ); - client.locationsClient.getLocation = stubSimpleCall(expectedResponse); - const response = await client.getLocation(request, expectedOptions); - assert.deepStrictEqual(response, [expectedResponse]); - assert( - (client.locationsClient.getLocation as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); - }); - it('invokes getLocation without error using callback', async () => { - const client = - new policybasedroutingserviceModule.v1.PolicyBasedRoutingServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ); - client.locationsClient.getLocation = sinon - .stub() - .callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getLocation( - request, - expectedOptions, - ( - err?: Error | null, - result?: LocationProtos.google.cloud.location.ILocation | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - } - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.locationsClient.getLocation as SinonStub).getCall(0)); - }); - it('invokes getLocation with error', async () => { - const client = - new policybasedroutingserviceModule.v1.PolicyBasedRoutingServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.locationsClient.getLocation = stubSimpleCall( - undefined, - expectedError - ); - await assert.rejects( - client.getLocation(request, expectedOptions), - expectedError - ); - assert( - (client.locationsClient.getLocation as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); - }); - }); - describe('listLocationsAsync', () => { - it('uses async iteration with listLocations without error', async () => { - const client = - new policybasedroutingserviceModule.v1.PolicyBasedRoutingServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.ListLocationsRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedResponse = [ - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - ]; - client.locationsClient.descriptors.page.listLocations.asyncIterate = - stubAsyncIterationCall(expectedResponse); - const responses: LocationProtos.google.cloud.location.ILocation[] = []; - const iterable = client.listLocationsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - ( - client.locationsClient.descriptors.page.listLocations - .asyncIterate as SinonStub - ).getCall(0).args[1], - request - ); - assert( - ( - client.locationsClient.descriptors.page.listLocations - .asyncIterate as SinonStub - ) - .getCall(0) - .args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - it('uses async iteration with listLocations with error', async () => { - const client = - new policybasedroutingserviceModule.v1.PolicyBasedRoutingServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.ListLocationsRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedError = new Error('expected'); - client.locationsClient.descriptors.page.listLocations.asyncIterate = - stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listLocationsAsync(request); - await assert.rejects(async () => { - const responses: LocationProtos.google.cloud.location.ILocation[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - ( - client.locationsClient.descriptors.page.listLocations - .asyncIterate as SinonStub - ).getCall(0).args[1], - request - ); - assert( - ( - client.locationsClient.descriptors.page.listLocations - .asyncIterate as SinonStub - ) - .getCall(0) - .args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - describe('getOperation', () => { - it('invokes getOperation without error', async () => { - const client = - new policybasedroutingserviceModule.v1.PolicyBasedRoutingServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.GetOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const response = await client.getOperation(request); - assert.deepStrictEqual(response, [expectedResponse]); - assert( - (client.operationsClient.getOperation as SinonStub) - .getCall(0) - .calledWith(request) - ); - }); - it('invokes getOperation without error using callback', async () => { - const client = - new policybasedroutingserviceModule.v1.PolicyBasedRoutingServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.GetOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - client.operationsClient.getOperation = sinon - .stub() - .callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.operationsClient.getOperation( - request, - undefined, - ( - err?: Error | null, - result?: operationsProtos.google.longrunning.Operation | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - } - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - it('invokes getOperation with error', async () => { - const client = - new policybasedroutingserviceModule.v1.PolicyBasedRoutingServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.GetOperationRequest() - ); - const expectedError = new Error('expected'); - client.operationsClient.getOperation = stubSimpleCall( - undefined, - expectedError - ); - await assert.rejects(async () => { - await client.getOperation(request); - }, expectedError); - assert( - (client.operationsClient.getOperation as SinonStub) - .getCall(0) - .calledWith(request) - ); - }); - }); - describe('cancelOperation', () => { - it('invokes cancelOperation without error', async () => { - const client = - new policybasedroutingserviceModule.v1.PolicyBasedRoutingServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.CancelOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.operationsClient.cancelOperation = - stubSimpleCall(expectedResponse); - const response = await client.cancelOperation(request); - assert.deepStrictEqual(response, [expectedResponse]); - assert( - (client.operationsClient.cancelOperation as SinonStub) - .getCall(0) - .calledWith(request) - ); - }); - it('invokes cancelOperation without error using callback', async () => { - const client = - new policybasedroutingserviceModule.v1.PolicyBasedRoutingServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.CancelOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.operationsClient.cancelOperation = sinon - .stub() - .callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.operationsClient.cancelOperation( - request, - undefined, - ( - err?: Error | null, - result?: protos.google.protobuf.Empty | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - } - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.operationsClient.cancelOperation as SinonStub).getCall(0)); - }); - it('invokes cancelOperation with error', async () => { - const client = - new policybasedroutingserviceModule.v1.PolicyBasedRoutingServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.CancelOperationRequest() - ); - const expectedError = new Error('expected'); - client.operationsClient.cancelOperation = stubSimpleCall( - undefined, - expectedError - ); - await assert.rejects(async () => { - await client.cancelOperation(request); - }, expectedError); - assert( - (client.operationsClient.cancelOperation as SinonStub) - .getCall(0) - .calledWith(request) - ); - }); - }); - describe('deleteOperation', () => { - it('invokes deleteOperation without error', async () => { - const client = - new policybasedroutingserviceModule.v1.PolicyBasedRoutingServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.DeleteOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.operationsClient.deleteOperation = - stubSimpleCall(expectedResponse); - const response = await client.deleteOperation(request); - assert.deepStrictEqual(response, [expectedResponse]); - assert( - (client.operationsClient.deleteOperation as SinonStub) - .getCall(0) - .calledWith(request) - ); - }); - it('invokes deleteOperation without error using callback', async () => { - const client = - new policybasedroutingserviceModule.v1.PolicyBasedRoutingServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.DeleteOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.operationsClient.deleteOperation = sinon - .stub() - .callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.operationsClient.deleteOperation( - request, - undefined, - ( - err?: Error | null, - result?: protos.google.protobuf.Empty | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - } - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.operationsClient.deleteOperation as SinonStub).getCall(0)); - }); - it('invokes deleteOperation with error', async () => { - const client = - new policybasedroutingserviceModule.v1.PolicyBasedRoutingServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.DeleteOperationRequest() - ); - const expectedError = new Error('expected'); - client.operationsClient.deleteOperation = stubSimpleCall( - undefined, - expectedError - ); - await assert.rejects(async () => { - await client.deleteOperation(request); - }, expectedError); - assert( - (client.operationsClient.deleteOperation as SinonStub) - .getCall(0) - .calledWith(request) - ); - }); - }); - describe('listOperationsAsync', () => { - it('uses async iteration with listOperations without error', async () => { - const client = - new policybasedroutingserviceModule.v1.PolicyBasedRoutingServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsRequest() - ); - const expectedResponse = [ - generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsResponse() - ), - generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsResponse() - ), - generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsResponse() - ), - ]; - client.operationsClient.descriptor.listOperations.asyncIterate = - stubAsyncIterationCall(expectedResponse); - const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = - []; - const iterable = client.operationsClient.listOperationsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - ( - client.operationsClient.descriptor.listOperations - .asyncIterate as SinonStub - ).getCall(0).args[1], - request - ); - }); - it('uses async iteration with listOperations with error', async () => { - const client = - new policybasedroutingserviceModule.v1.PolicyBasedRoutingServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsRequest() - ); - const expectedError = new Error('expected'); - client.operationsClient.descriptor.listOperations.asyncIterate = - stubAsyncIterationCall(undefined, expectedError); - const iterable = client.operationsClient.listOperationsAsync(request); - await assert.rejects(async () => { - const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = - []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - ( - client.operationsClient.descriptor.listOperations - .asyncIterate as SinonStub - ).getCall(0).args[1], - request - ); - }); - }); - - describe('Path templates', () => { - describe('hub', () => { - const fakePath = '/rendered/path/hub'; - const expectedParameters = { - project: 'projectValue', - hub: 'hubValue', - }; - const client = - new policybasedroutingserviceModule.v1.PolicyBasedRoutingServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.hubPathTemplate.render = sinon - .stub() - .returns(fakePath); - client.pathTemplates.hubPathTemplate.match = sinon - .stub() - .returns(expectedParameters); - - it('hubPath', () => { - const result = client.hubPath('projectValue', 'hubValue'); - assert.strictEqual(result, fakePath); - assert( - (client.pathTemplates.hubPathTemplate.render as SinonStub) - .getCall(-1) - .calledWith(expectedParameters) - ); - }); - - it('matchProjectFromHubName', () => { - const result = client.matchProjectFromHubName(fakePath); - assert.strictEqual(result, 'projectValue'); - assert( - (client.pathTemplates.hubPathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath) - ); - }); - - it('matchHubFromHubName', () => { - const result = client.matchHubFromHubName(fakePath); - assert.strictEqual(result, 'hubValue'); - assert( - (client.pathTemplates.hubPathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath) - ); - }); - }); - - describe('location', () => { - const fakePath = '/rendered/path/location'; - const expectedParameters = { - project: 'projectValue', - location: 'locationValue', - }; - const client = - new policybasedroutingserviceModule.v1.PolicyBasedRoutingServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.locationPathTemplate.render = sinon - .stub() - .returns(fakePath); - client.pathTemplates.locationPathTemplate.match = sinon - .stub() - .returns(expectedParameters); - - it('locationPath', () => { - const result = client.locationPath('projectValue', 'locationValue'); - assert.strictEqual(result, fakePath); - assert( - (client.pathTemplates.locationPathTemplate.render as SinonStub) - .getCall(-1) - .calledWith(expectedParameters) - ); - }); - - it('matchProjectFromLocationName', () => { - const result = client.matchProjectFromLocationName(fakePath); - assert.strictEqual(result, 'projectValue'); - assert( - (client.pathTemplates.locationPathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath) - ); - }); - - it('matchLocationFromLocationName', () => { - const result = client.matchLocationFromLocationName(fakePath); - assert.strictEqual(result, 'locationValue'); - assert( - (client.pathTemplates.locationPathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath) - ); - }); - }); - - describe('network', () => { - const fakePath = '/rendered/path/network'; - const expectedParameters = { - project: 'projectValue', - resource_id: 'resourceIdValue', - }; - const client = - new policybasedroutingserviceModule.v1.PolicyBasedRoutingServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.networkPathTemplate.render = sinon - .stub() - .returns(fakePath); - client.pathTemplates.networkPathTemplate.match = sinon - .stub() - .returns(expectedParameters); - - it('networkPath', () => { - const result = client.networkPath('projectValue', 'resourceIdValue'); - assert.strictEqual(result, fakePath); - assert( - (client.pathTemplates.networkPathTemplate.render as SinonStub) - .getCall(-1) - .calledWith(expectedParameters) - ); - }); - - it('matchProjectFromNetworkName', () => { - const result = client.matchProjectFromNetworkName(fakePath); - assert.strictEqual(result, 'projectValue'); - assert( - (client.pathTemplates.networkPathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath) - ); - }); - - it('matchResourceIdFromNetworkName', () => { - const result = client.matchResourceIdFromNetworkName(fakePath); - assert.strictEqual(result, 'resourceIdValue'); - assert( - (client.pathTemplates.networkPathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath) - ); - }); - }); - - describe('policyBasedRoute', () => { - const fakePath = '/rendered/path/policyBasedRoute'; - const expectedParameters = { - project: 'projectValue', - location: 'locationValue', - policy_based_route: 'policyBasedRouteValue', - }; - const client = - new policybasedroutingserviceModule.v1.PolicyBasedRoutingServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.policyBasedRoutePathTemplate.render = sinon - .stub() - .returns(fakePath); - client.pathTemplates.policyBasedRoutePathTemplate.match = sinon - .stub() - .returns(expectedParameters); - - it('policyBasedRoutePath', () => { - const result = client.policyBasedRoutePath( - 'projectValue', - 'locationValue', - 'policyBasedRouteValue' - ); - assert.strictEqual(result, fakePath); - assert( - ( - client.pathTemplates.policyBasedRoutePathTemplate - .render as SinonStub - ) - .getCall(-1) - .calledWith(expectedParameters) - ); - }); - - it('matchProjectFromPolicyBasedRouteName', () => { - const result = client.matchProjectFromPolicyBasedRouteName(fakePath); - assert.strictEqual(result, 'projectValue'); - assert( - (client.pathTemplates.policyBasedRoutePathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath) - ); - }); - - it('matchLocationFromPolicyBasedRouteName', () => { - const result = client.matchLocationFromPolicyBasedRouteName(fakePath); - assert.strictEqual(result, 'locationValue'); - assert( - (client.pathTemplates.policyBasedRoutePathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath) - ); - }); - - it('matchPolicyBasedRouteFromPolicyBasedRouteName', () => { - const result = - client.matchPolicyBasedRouteFromPolicyBasedRouteName(fakePath); - assert.strictEqual(result, 'policyBasedRouteValue'); - assert( - (client.pathTemplates.policyBasedRoutePathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath) - ); - }); - }); - - describe('spoke', () => { - const fakePath = '/rendered/path/spoke'; - const expectedParameters = { - project: 'projectValue', - location: 'locationValue', - spoke: 'spokeValue', - }; - const client = - new policybasedroutingserviceModule.v1.PolicyBasedRoutingServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.spokePathTemplate.render = sinon - .stub() - .returns(fakePath); - client.pathTemplates.spokePathTemplate.match = sinon - .stub() - .returns(expectedParameters); - - it('spokePath', () => { - const result = client.spokePath( - 'projectValue', - 'locationValue', - 'spokeValue' - ); - assert.strictEqual(result, fakePath); - assert( - (client.pathTemplates.spokePathTemplate.render as SinonStub) - .getCall(-1) - .calledWith(expectedParameters) - ); - }); - - it('matchProjectFromSpokeName', () => { - const result = client.matchProjectFromSpokeName(fakePath); - assert.strictEqual(result, 'projectValue'); - assert( - (client.pathTemplates.spokePathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath) - ); - }); - - it('matchLocationFromSpokeName', () => { - const result = client.matchLocationFromSpokeName(fakePath); - assert.strictEqual(result, 'locationValue'); - assert( - (client.pathTemplates.spokePathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath) - ); - }); - - it('matchSpokeFromSpokeName', () => { - const result = client.matchSpokeFromSpokeName(fakePath); - assert.strictEqual(result, 'spokeValue'); - assert( - (client.pathTemplates.spokePathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath) - ); - }); - }); - }); -});