diff --git a/protos/google/cloud/networkconnectivity/v1/common.proto b/protos/google/cloud/networkconnectivity/v1/common.proto new file mode 100644 index 0000000..014e23f --- /dev/null +++ b/protos/google/cloud/networkconnectivity/v1/common.proto @@ -0,0 +1,56 @@ +// Copyright 2021 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/field_behavior.proto"; +import "google/protobuf/timestamp.proto"; +import "google/api/annotations.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 = "CommonProto"; +option java_package = "com.google.cloud.networkconnectivity.v1"; +option php_namespace = "Google\\Cloud\\NetworkConnectivity\\V1"; +option ruby_package = "Google::Cloud::NetworkConnectivity::V1"; + +// Represents the metadata of the long-running operation. +message OperationMetadata { + // Output only. The time the operation was created. + google.protobuf.Timestamp create_time = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The time the operation finished running. + google.protobuf.Timestamp end_time = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Server-defined resource path for the target of the operation. + string target = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Name of the verb executed by the operation. + string verb = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Human-readable status of the operation, if any. + string status_message = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Identifies whether the user has requested cancellation + // of the operation. Operations that have successfully been cancelled + // have [Operation.error][] value with a [google.rpc.Status.code][google.rpc.Status.code] of 1, + // corresponding to `Code.CANCELLED`. + bool requested_cancellation = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. API version used to start the operation. + string api_version = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; +} diff --git a/protos/google/cloud/networkconnectivity/v1/hub.proto b/protos/google/cloud/networkconnectivity/v1/hub.proto new file mode 100644 index 0000000..ac43a23 --- /dev/null +++ b/protos/google/cloud/networkconnectivity/v1/hub.proto @@ -0,0 +1,704 @@ +// Copyright 2021 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/field_mask.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 = "HubProto"; +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/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"; + + // Lists hubs in a given project. + rpc ListHubs(ListHubsRequest) returns (ListHubsResponse) { + option (google.api.http) = { + get: "/v1/{parent=projects/*/locations/global}/hubs" + }; + option (google.api.method_signature) = "parent"; + } + + // Gets details about the specified hub. + rpc GetHub(GetHubRequest) returns (Hub) { + option (google.api.http) = { + get: "/v1/{name=projects/*/locations/global/hubs/*}" + }; + option (google.api.method_signature) = "name"; + } + + // 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" + body: "hub" + }; + option (google.api.method_signature) = "parent,hub,hub_id"; + option (google.longrunning.operation_info) = { + response_type: "Hub" + metadata_type: "OperationMetadata" + }; + } + + // 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/*}" + body: "hub" + }; + option (google.api.method_signature) = "hub,update_mask"; + option (google.longrunning.operation_info) = { + response_type: "Hub" + metadata_type: "OperationMetadata" + }; + } + + // Deletes the specified hub. + rpc DeleteHub(DeleteHubRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + delete: "/v1/{name=projects/*/locations/global/hubs/*}" + }; + option (google.api.method_signature) = "name"; + option (google.longrunning.operation_info) = { + response_type: "google.protobuf.Empty" + metadata_type: "OperationMetadata" + }; + } + + // Lists the spokes in the specified project and location. + rpc ListSpokes(ListSpokesRequest) returns (ListSpokesResponse) { + option (google.api.http) = { + get: "/v1/{parent=projects/*/locations/*}/spokes" + }; + option (google.api.method_signature) = "parent"; + } + + // Gets details about the specified spoke. + rpc GetSpoke(GetSpokeRequest) returns (Spoke) { + option (google.api.http) = { + get: "/v1/{name=projects/*/locations/*/spokes/*}" + }; + option (google.api.method_signature) = "name"; + } + + // 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" + body: "spoke" + }; + option (google.api.method_signature) = "parent,spoke,spoke_id"; + option (google.longrunning.operation_info) = { + response_type: "Spoke" + metadata_type: "OperationMetadata" + }; + } + + // 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/*}" + body: "spoke" + }; + option (google.api.method_signature) = "spoke,update_mask"; + option (google.longrunning.operation_info) = { + response_type: "Spoke" + metadata_type: "OperationMetadata" + }; + } + + // Deactivates the specified spoke. Deactivating keeps the spoke information + // for future re-activation, but disconnects the Google Cloud network from + // non-Google-Cloud network. + rpc DeactivateSpoke(DeactivateSpokeRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1/{name=projects/*/locations/*/spokes/*}:deactivate" + body: "*" + }; + option (google.api.method_signature) = "name"; + option (google.longrunning.operation_info) = { + response_type: "Spoke" + metadata_type: "OperationMetadata" + }; + } + + // Activates the specified spoke. Activating reconnects the Google Cloud + // network with the non-Google-Cloud network. + rpc ActivateSpoke(ActivateSpokeRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1/{name=projects/*/locations/*/spokes/*}:activate" + body: "*" + }; + option (google.api.method_signature) = "name"; + option (google.longrunning.operation_info) = { + response_type: "Spoke" + metadata_type: "OperationMetadata" + }; + } + + // Deletes the specified spoke. + rpc DeleteSpoke(DeleteSpokeRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + delete: "/v1/{name=projects/*/locations/*/spokes/*}" + }; + option (google.api.method_signature) = "name"; + option (google.longrunning.operation_info) = { + response_type: "google.protobuf.Empty" + metadata_type: "OperationMetadata" + }; + } +} + +// A hub is essentially a collection of spokes. A single hub can contain spokes +// from multiple regions. However, all of a hub's spokes must be associated with +// resources that reside in the same VPC network. +message Hub { + option (google.api.resource) = { + type: "networkconnectivity.googleapis.com/Hub" + pattern: "projects/{project}/locations/global/hubs/{hub}" + }; + + // Immutable. The name of the hub. Hub names must be unique. They use the + // following form: + // `projects/{project_number}/locations/global/hubs/{hub_id}` + 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]; + + // Output only. The time the hub was last updated. + 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 + // labels](https://cloud.google.com/resource-manager/docs/creating-managing-labels#requirements). + map labels = 4; + + // 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. + string unique_id = 8 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The current lifecycle state of this hub. + State state = 9 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// The State enum represents the lifecycle stage of a Network Connectivity +// Center resource. +enum State { + // No state information available + STATE_UNSPECIFIED = 0; + + // The resource's create operation is in progress + CREATING = 1; + + // The resource is active + ACTIVE = 2; + + // The resource's Delete operation is in progress + DELETING = 3; +} + +// 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: +// +// * linked_vpn_tunnels +// * linked_interconnect_attachments +// * linked_router_appliance_instances +message Spoke { + option (google.api.resource) = { + type: "networkconnectivity.googleapis.com/Spoke" + pattern: "projects/{project}/locations/{location}/spokes/{spoke}" + }; + + // Immutable. The name of the spoke. Spoke names must be unique. They use the + // following form: + // `projects/{project_number}/locations/{region}/spokes/{spoke_id}` + 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]; + + // Output only. The time the spoke was last updated. + 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 + // labels](https://cloud.google.com/resource-manager/docs/creating-managing-labels#requirements). + map labels = 4; + + // An optional description of the spoke. + string description = 5; + + // Immutable. The URI of the hub that this spoke is attached to. + string hub = 6 [ + (google.api.field_behavior) = IMMUTABLE, + (google.api.resource_reference) = { + type: "networkconnectivity.googleapis.com/Hub" + } + ]; + + // VPN tunnels that are associated with the spoke. + LinkedVpnTunnels linked_vpn_tunnels = 17; + + // VLAN attachments that are associated with the spoke. + LinkedInterconnectAttachments linked_interconnect_attachments = 18; + + // 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. + 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. +message ListHubsRequest { + // 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; + + // An 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 [HubService.ListHubs][google.cloud.networkconnectivity.v1.HubService.ListHubs] method. +message ListHubsResponse { + // The requested hubs. + repeated Hub hubs = 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 [HubService.GetHub][google.cloud.networkconnectivity.v1.HubService.GetHub] method. +message GetHubRequest { + // Required. The name of the hub resource to get. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "networkconnectivity.googleapis.com/Hub" + } + ]; +} + +// Request for [HubService.CreateHub][google.cloud.networkconnectivity.v1.HubService.CreateHub] method. +message CreateHubRequest { + // Required. The parent resource. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "locations.googleapis.com/Location" + } + ]; + + // Optional. A unique identifier for the hub. + string hub_id = 2 [(google.api.field_behavior) = OPTIONAL]; + + // 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. + // + // 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 + // was received. If it was, the server ignores the second request. This + // behavior prevents clients from mistakenly 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 [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]; + + // 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. + // + // 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 + // was received. If it was, the server ignores the second request. This + // behavior prevents clients from mistakenly 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 = 3 [(google.api.field_behavior) = OPTIONAL]; +} + +// The request for [HubService.DeleteHub][google.cloud.networkconnectivity.v1.HubService.DeleteHub]. +message DeleteHubRequest { + // Required. The name of the hub to delete. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "networkconnectivity.googleapis.com/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. + // + // 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 + // was received. If it was, the server ignores the second request. This + // behavior prevents clients from mistakenly 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]; +} + +// The request for [HubService.ListSpokes][google.cloud.networkconnectivity.v1.HubService.ListSpokes]. +message ListSpokesRequest { + // Required. The parent resource. + 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; + + // An expression that filters the results listed in the response. + string filter = 4; + + // Sort the results by a certain order. + string order_by = 5; +} + +// The response for [HubService.ListSpokes][google.cloud.networkconnectivity.v1.HubService.ListSpokes]. +message ListSpokesResponse { + // The requested spokes. + repeated Spoke spokes = 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; +} + +// The request for [HubService.GetSpoke][google.cloud.networkconnectivity.v1.HubService.GetSpoke]. +message GetSpokeRequest { + // Required. The name of the spoke resource. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "networkconnectivity.googleapis.com/Spoke" + } + ]; +} + +// The request for [HubService.CreateSpoke][google.cloud.networkconnectivity.v1.HubService.CreateSpoke]. +message CreateSpokeRequest { + // Required. The parent resource. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "locations.googleapis.com/Location" + } + ]; + + // Optional. Unique id for the spoke to create. + string spoke_id = 2 [(google.api.field_behavior) = OPTIONAL]; + + // 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. + // + // 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 + // was received. If it was, the server ignores the second request. This + // behavior prevents clients from mistakenly 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 [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 + // 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 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. + // + // 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 + // was received. If it was, the server ignores the second request. This + // behavior prevents clients from mistakenly 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 = 3 [(google.api.field_behavior) = OPTIONAL]; +} + +// The request for [HubService.DeleteSpoke][google.cloud.networkconnectivity.v1.HubService.DeleteSpoke]. +message DeleteSpokeRequest { + // Required. The name of the spoke to delete. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "networkconnectivity.googleapis.com/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. + // + // 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 + // was received. If it was, the server ignores the second request. This + // behavior prevents clients from mistakenly 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]; +} + +// The request for [HubService.DeactivateSpoke][google.cloud.networkconnectivity.v1.HubService.DeactivateSpoke]. +message DeactivateSpokeRequest { + // Required. The name of the spoke to deactivate. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "networkconnectivity.googleapis.com/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. + // + // 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 + // was received. If it was, the server ignores the second request. This + // behavior prevents clients from mistakenly 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]; +} + +// The request for [HubService.ActivateSpoke][google.cloud.networkconnectivity.v1.HubService.ActivateSpoke]. +message ActivateSpokeRequest { + // Required. The name of the spoke to activate. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "networkconnectivity.googleapis.com/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. + // + // 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 + // was received. If it was, the server ignores the second request. This + // behavior prevents clients from mistakenly 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]; +} + +// A collection of Cloud VPN tunnel resources. These resources should be +// redundant HA VPN tunnels that all advertise the same prefixes to Google +// Cloud. Alternatively, in a passive/active configuration, all tunnels +// should be capable of advertising the same prefixes. +message LinkedVpnTunnels { + // The URIs of linked VPN tunnel resources. + repeated string uris = 1 [(google.api.resource_reference) = { + type: "compute.googleapis.com/VpnTunnel" + }]; + + // A value that controls whether site-to-site data transfer is enabled for + // these resources. If true, routes are propagated between the spoke + // associated with these resources and other spokes in the hub that have data + // transfer enabled. If false, the spoke associated with these resources + // provides connectivity only between the external site and Google Cloud. In + // regions where data transfer is unsupported, you cannot set this field + // to true. + bool site_to_site_data_transfer = 2; +} + +// A collection of VLAN attachment resources. These resources should +// be redundant attachments that all advertise the same prefixes to Google +// Cloud. Alternatively, in active/passive configurations, all attachments +// should be capable of advertising the same prefixes. +message LinkedInterconnectAttachments { + // The URIs of linked interconnect attachment resources + repeated string uris = 1 [(google.api.resource_reference) = { + type: "compute.googleapis.com/InterconnectAttachment" + }]; + + // A value that controls whether site-to-site data transfer is enabled for + // these resources. If true, routes are propagated between the spoke + // associated with these resources and other spokes in the hub that have data + // transfer enabled. If false, the spoke associated with these resources + // provides connectivity only between the external site and Google Cloud. In + // regions where data transfer is unsupported, you cannot set this field + // to true. + bool site_to_site_data_transfer = 2; +} + +// A collection of router appliance instances. If you have multiple router +// appliance instances connected to the same site, they should all be attached +// to the same spoke. +message LinkedRouterApplianceInstances { + // The list of router appliance instances. + repeated RouterApplianceInstance instances = 1; + + // A value that controls whether site-to-site data transfer is enabled for + // these resources. If true, routes are propagated between the spoke + // associated with these resources and other spokes in the hub that have data + // transfer enabled. If false, the spoke associated with these resources + // provides connectivity only between the external site and Google Cloud. In + // regions where data transfer is unsupported, you cannot set this field + // to true. + bool site_to_site_data_transfer = 2; +} + +// A router appliance instance is a Compute Engine virtual machine (VM) instance +// that acts as a BGP speaker. A router appliance instance is specified by the +// URI of the VM and the internal IP address of one of the VM's network +// interfaces. +message RouterApplianceInstance { + // The URI of the VM. + string virtual_machine = 1 [(google.api.resource_reference) = { + type: "compute.googleapis.com/Instance" + }]; + + // The IP address on the VM to use for peering. + string ip_address = 3; +} diff --git a/protos/protos.d.ts b/protos/protos.d.ts index c174eb1..5266152 100644 --- a/protos/protos.d.ts +++ b/protos/protos.d.ts @@ -23,6 +23,2496 @@ export namespace google { /** Namespace networkconnectivity. */ namespace networkconnectivity { + /** Namespace v1. */ + namespace v1 { + + /** 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.v1.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.v1.IOperationMetadata): google.cloud.networkconnectivity.v1.OperationMetadata; + + /** + * Encodes the specified OperationMetadata message. Does not implicitly {@link google.cloud.networkconnectivity.v1.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.IOperationMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified OperationMetadata message, length delimited. Does not implicitly {@link google.cloud.networkconnectivity.v1.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.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.v1.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.v1.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.v1.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.v1.OperationMetadata, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this OperationMetadata to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** 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.v1.IListHubsRequest, callback: google.cloud.networkconnectivity.v1.HubService.ListHubsCallback): void; + + /** + * Calls ListHubs. + * @param request ListHubsRequest message or plain object + * @returns Promise + */ + public listHubs(request: google.cloud.networkconnectivity.v1.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.v1.IGetHubRequest, callback: google.cloud.networkconnectivity.v1.HubService.GetHubCallback): void; + + /** + * Calls GetHub. + * @param request GetHubRequest message or plain object + * @returns Promise + */ + public getHub(request: google.cloud.networkconnectivity.v1.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.v1.ICreateHubRequest, callback: google.cloud.networkconnectivity.v1.HubService.CreateHubCallback): void; + + /** + * Calls CreateHub. + * @param request CreateHubRequest message or plain object + * @returns Promise + */ + public createHub(request: google.cloud.networkconnectivity.v1.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.v1.IUpdateHubRequest, callback: google.cloud.networkconnectivity.v1.HubService.UpdateHubCallback): void; + + /** + * Calls UpdateHub. + * @param request UpdateHubRequest message or plain object + * @returns Promise + */ + public updateHub(request: google.cloud.networkconnectivity.v1.IUpdateHubRequest): Promise; + + /** + * Calls DeleteHub. + * @param request DeleteHubRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public deleteHub(request: google.cloud.networkconnectivity.v1.IDeleteHubRequest, callback: google.cloud.networkconnectivity.v1.HubService.DeleteHubCallback): void; + + /** + * Calls DeleteHub. + * @param request DeleteHubRequest message or plain object + * @returns Promise + */ + public deleteHub(request: google.cloud.networkconnectivity.v1.IDeleteHubRequest): Promise; + + /** + * Calls ListSpokes. + * @param request ListSpokesRequest message or plain object + * @param callback Node-style callback called with the error, if any, and ListSpokesResponse + */ + public listSpokes(request: google.cloud.networkconnectivity.v1.IListSpokesRequest, callback: google.cloud.networkconnectivity.v1.HubService.ListSpokesCallback): void; + + /** + * Calls ListSpokes. + * @param request ListSpokesRequest message or plain object + * @returns Promise + */ + public listSpokes(request: google.cloud.networkconnectivity.v1.IListSpokesRequest): Promise; + + /** + * Calls GetSpoke. + * @param request GetSpokeRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Spoke + */ + public getSpoke(request: google.cloud.networkconnectivity.v1.IGetSpokeRequest, callback: google.cloud.networkconnectivity.v1.HubService.GetSpokeCallback): void; + + /** + * Calls GetSpoke. + * @param request GetSpokeRequest message or plain object + * @returns Promise + */ + public getSpoke(request: google.cloud.networkconnectivity.v1.IGetSpokeRequest): Promise; + + /** + * Calls CreateSpoke. + * @param request CreateSpokeRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public createSpoke(request: google.cloud.networkconnectivity.v1.ICreateSpokeRequest, callback: google.cloud.networkconnectivity.v1.HubService.CreateSpokeCallback): void; + + /** + * Calls CreateSpoke. + * @param request CreateSpokeRequest message or plain object + * @returns Promise + */ + public createSpoke(request: google.cloud.networkconnectivity.v1.ICreateSpokeRequest): Promise; + + /** + * Calls UpdateSpoke. + * @param request UpdateSpokeRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public updateSpoke(request: google.cloud.networkconnectivity.v1.IUpdateSpokeRequest, callback: google.cloud.networkconnectivity.v1.HubService.UpdateSpokeCallback): void; + + /** + * Calls UpdateSpoke. + * @param request UpdateSpokeRequest message or plain object + * @returns Promise + */ + public updateSpoke(request: google.cloud.networkconnectivity.v1.IUpdateSpokeRequest): Promise; + + /** + * Calls DeactivateSpoke. + * @param request DeactivateSpokeRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public deactivateSpoke(request: google.cloud.networkconnectivity.v1.IDeactivateSpokeRequest, callback: google.cloud.networkconnectivity.v1.HubService.DeactivateSpokeCallback): void; + + /** + * Calls DeactivateSpoke. + * @param request DeactivateSpokeRequest message or plain object + * @returns Promise + */ + public deactivateSpoke(request: google.cloud.networkconnectivity.v1.IDeactivateSpokeRequest): Promise; + + /** + * Calls ActivateSpoke. + * @param request ActivateSpokeRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public activateSpoke(request: google.cloud.networkconnectivity.v1.IActivateSpokeRequest, callback: google.cloud.networkconnectivity.v1.HubService.ActivateSpokeCallback): void; + + /** + * Calls ActivateSpoke. + * @param request ActivateSpokeRequest message or plain object + * @returns Promise + */ + public activateSpoke(request: google.cloud.networkconnectivity.v1.IActivateSpokeRequest): Promise; + + /** + * Calls DeleteSpoke. + * @param request DeleteSpokeRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public deleteSpoke(request: google.cloud.networkconnectivity.v1.IDeleteSpokeRequest, callback: google.cloud.networkconnectivity.v1.HubService.DeleteSpokeCallback): void; + + /** + * Calls DeleteSpoke. + * @param request DeleteSpokeRequest message or plain object + * @returns Promise + */ + public deleteSpoke(request: google.cloud.networkconnectivity.v1.IDeleteSpokeRequest): Promise; + } + + namespace HubService { + + /** + * Callback as used by {@link google.cloud.networkconnectivity.v1.HubService#listHubs}. + * @param error Error, if any + * @param [response] ListHubsResponse + */ + type ListHubsCallback = (error: (Error|null), response?: google.cloud.networkconnectivity.v1.ListHubsResponse) => void; + + /** + * Callback as used by {@link google.cloud.networkconnectivity.v1.HubService#getHub}. + * @param error Error, if any + * @param [response] Hub + */ + type GetHubCallback = (error: (Error|null), response?: google.cloud.networkconnectivity.v1.Hub) => void; + + /** + * Callback as used by {@link google.cloud.networkconnectivity.v1.HubService#createHub}. + * @param error Error, if any + * @param [response] Operation + */ + type CreateHubCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + + /** + * Callback as used by {@link google.cloud.networkconnectivity.v1.HubService#updateHub}. + * @param error Error, if any + * @param [response] Operation + */ + type UpdateHubCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + + /** + * Callback as used by {@link google.cloud.networkconnectivity.v1.HubService#deleteHub}. + * @param error Error, if any + * @param [response] Operation + */ + type DeleteHubCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + + /** + * Callback as used by {@link google.cloud.networkconnectivity.v1.HubService#listSpokes}. + * @param error Error, if any + * @param [response] ListSpokesResponse + */ + type ListSpokesCallback = (error: (Error|null), response?: google.cloud.networkconnectivity.v1.ListSpokesResponse) => void; + + /** + * Callback as used by {@link google.cloud.networkconnectivity.v1.HubService#getSpoke}. + * @param error Error, if any + * @param [response] Spoke + */ + type GetSpokeCallback = (error: (Error|null), response?: google.cloud.networkconnectivity.v1.Spoke) => void; + + /** + * Callback as used by {@link google.cloud.networkconnectivity.v1.HubService#createSpoke}. + * @param error Error, if any + * @param [response] Operation + */ + type CreateSpokeCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + + /** + * Callback as used by {@link google.cloud.networkconnectivity.v1.HubService#updateSpoke}. + * @param error Error, if any + * @param [response] Operation + */ + type UpdateSpokeCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + + /** + * Callback as used by {@link google.cloud.networkconnectivity.v1.HubService#deactivateSpoke}. + * @param error Error, if any + * @param [response] Operation + */ + type DeactivateSpokeCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + + /** + * Callback as used by {@link google.cloud.networkconnectivity.v1.HubService#activateSpoke}. + * @param error Error, if any + * @param [response] Operation + */ + type ActivateSpokeCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + + /** + * Callback as used by {@link google.cloud.networkconnectivity.v1.HubService#deleteSpoke}. + * @param error Error, if any + * @param [response] Operation + */ + type DeleteSpokeCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + } + + /** Properties of a Hub. */ + interface IHub { + + /** Hub name */ + name?: (string|null); + + /** Hub createTime */ + createTime?: (google.protobuf.ITimestamp|null); + + /** Hub updateTime */ + updateTime?: (google.protobuf.ITimestamp|null); + + /** Hub labels */ + labels?: ({ [k: string]: string }|null); + + /** Hub description */ + description?: (string|null); + + /** Hub uniqueId */ + uniqueId?: (string|null); + + /** Hub state */ + state?: (google.cloud.networkconnectivity.v1.State|keyof typeof google.cloud.networkconnectivity.v1.State|null); + } + + /** Represents a Hub. */ + class Hub implements IHub { + + /** + * Constructs a new Hub. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.networkconnectivity.v1.IHub); + + /** Hub name. */ + public name: string; + + /** Hub createTime. */ + public createTime?: (google.protobuf.ITimestamp|null); + + /** Hub updateTime. */ + public updateTime?: (google.protobuf.ITimestamp|null); + + /** Hub labels. */ + public labels: { [k: string]: string }; + + /** Hub description. */ + public description: string; + + /** Hub uniqueId. */ + public uniqueId: string; + + /** Hub state. */ + public state: (google.cloud.networkconnectivity.v1.State|keyof typeof google.cloud.networkconnectivity.v1.State); + + /** + * Creates a new Hub instance using the specified properties. + * @param [properties] Properties to set + * @returns Hub instance + */ + public static create(properties?: google.cloud.networkconnectivity.v1.IHub): google.cloud.networkconnectivity.v1.Hub; + + /** + * Encodes the specified Hub message. Does not implicitly {@link google.cloud.networkconnectivity.v1.Hub.verify|verify} messages. + * @param message Hub message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.networkconnectivity.v1.IHub, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Hub message, length delimited. Does not implicitly {@link google.cloud.networkconnectivity.v1.Hub.verify|verify} messages. + * @param message Hub message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.networkconnectivity.v1.IHub, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Hub message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Hub + * @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.Hub; + + /** + * Decodes a Hub message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Hub + * @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.Hub; + + /** + * Verifies a Hub 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 Hub message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Hub + */ + public static fromObject(object: { [k: string]: any }): google.cloud.networkconnectivity.v1.Hub; + + /** + * Creates a plain object from a Hub message. Also converts values to other types if specified. + * @param message Hub + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.networkconnectivity.v1.Hub, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Hub to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** State enum. */ + enum State { + STATE_UNSPECIFIED = 0, + CREATING = 1, + ACTIVE = 2, + DELETING = 3 + } + + /** Properties of a Spoke. */ + interface ISpoke { + + /** Spoke name */ + name?: (string|null); + + /** Spoke createTime */ + createTime?: (google.protobuf.ITimestamp|null); + + /** Spoke updateTime */ + updateTime?: (google.protobuf.ITimestamp|null); + + /** Spoke labels */ + labels?: ({ [k: string]: string }|null); + + /** Spoke description */ + description?: (string|null); + + /** Spoke hub */ + hub?: (string|null); + + /** Spoke linkedVpnTunnels */ + linkedVpnTunnels?: (google.cloud.networkconnectivity.v1.ILinkedVpnTunnels|null); + + /** Spoke linkedInterconnectAttachments */ + linkedInterconnectAttachments?: (google.cloud.networkconnectivity.v1.ILinkedInterconnectAttachments|null); + + /** Spoke linkedRouterApplianceInstances */ + linkedRouterApplianceInstances?: (google.cloud.networkconnectivity.v1.ILinkedRouterApplianceInstances|null); + + /** Spoke uniqueId */ + uniqueId?: (string|null); + + /** Spoke state */ + state?: (google.cloud.networkconnectivity.v1.State|keyof typeof google.cloud.networkconnectivity.v1.State|null); + } + + /** Represents a Spoke. */ + class Spoke implements ISpoke { + + /** + * Constructs a new Spoke. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.networkconnectivity.v1.ISpoke); + + /** Spoke name. */ + public name: string; + + /** Spoke createTime. */ + public createTime?: (google.protobuf.ITimestamp|null); + + /** Spoke updateTime. */ + public updateTime?: (google.protobuf.ITimestamp|null); + + /** Spoke labels. */ + public labels: { [k: string]: string }; + + /** Spoke description. */ + public description: string; + + /** Spoke hub. */ + public hub: string; + + /** Spoke linkedVpnTunnels. */ + public linkedVpnTunnels?: (google.cloud.networkconnectivity.v1.ILinkedVpnTunnels|null); + + /** Spoke linkedInterconnectAttachments. */ + public linkedInterconnectAttachments?: (google.cloud.networkconnectivity.v1.ILinkedInterconnectAttachments|null); + + /** Spoke linkedRouterApplianceInstances. */ + public linkedRouterApplianceInstances?: (google.cloud.networkconnectivity.v1.ILinkedRouterApplianceInstances|null); + + /** Spoke uniqueId. */ + public uniqueId: string; + + /** Spoke state. */ + public state: (google.cloud.networkconnectivity.v1.State|keyof typeof google.cloud.networkconnectivity.v1.State); + + /** + * Creates a new Spoke instance using the specified properties. + * @param [properties] Properties to set + * @returns Spoke instance + */ + public static create(properties?: google.cloud.networkconnectivity.v1.ISpoke): google.cloud.networkconnectivity.v1.Spoke; + + /** + * Encodes the specified Spoke message. Does not implicitly {@link google.cloud.networkconnectivity.v1.Spoke.verify|verify} messages. + * @param message Spoke message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.networkconnectivity.v1.ISpoke, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Spoke message, length delimited. Does not implicitly {@link google.cloud.networkconnectivity.v1.Spoke.verify|verify} messages. + * @param message Spoke message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.networkconnectivity.v1.ISpoke, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Spoke message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Spoke + * @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.Spoke; + + /** + * Decodes a Spoke message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Spoke + * @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.Spoke; + + /** + * Verifies a Spoke 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 Spoke message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Spoke + */ + public static fromObject(object: { [k: string]: any }): google.cloud.networkconnectivity.v1.Spoke; + + /** + * Creates a plain object from a Spoke message. Also converts values to other types if specified. + * @param message Spoke + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.networkconnectivity.v1.Spoke, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Spoke to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a ListHubsRequest. */ + interface IListHubsRequest { + + /** ListHubsRequest parent */ + parent?: (string|null); + + /** ListHubsRequest pageSize */ + pageSize?: (number|null); + + /** ListHubsRequest pageToken */ + pageToken?: (string|null); + + /** ListHubsRequest filter */ + filter?: (string|null); + + /** ListHubsRequest orderBy */ + orderBy?: (string|null); + } + + /** Represents a ListHubsRequest. */ + class ListHubsRequest implements IListHubsRequest { + + /** + * Constructs a new ListHubsRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.networkconnectivity.v1.IListHubsRequest); + + /** ListHubsRequest parent. */ + public parent: string; + + /** ListHubsRequest pageSize. */ + public pageSize: number; + + /** ListHubsRequest pageToken. */ + public pageToken: string; + + /** ListHubsRequest filter. */ + public filter: string; + + /** ListHubsRequest orderBy. */ + public orderBy: string; + + /** + * Creates a new ListHubsRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns ListHubsRequest instance + */ + public static create(properties?: google.cloud.networkconnectivity.v1.IListHubsRequest): google.cloud.networkconnectivity.v1.ListHubsRequest; + + /** + * Encodes the specified ListHubsRequest message. Does not implicitly {@link google.cloud.networkconnectivity.v1.ListHubsRequest.verify|verify} messages. + * @param message ListHubsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.networkconnectivity.v1.IListHubsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListHubsRequest message, length delimited. Does not implicitly {@link google.cloud.networkconnectivity.v1.ListHubsRequest.verify|verify} messages. + * @param message ListHubsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.networkconnectivity.v1.IListHubsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListHubsRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListHubsRequest + * @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.ListHubsRequest; + + /** + * Decodes a ListHubsRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListHubsRequest + * @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.ListHubsRequest; + + /** + * Verifies a ListHubsRequest 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 ListHubsRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListHubsRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.networkconnectivity.v1.ListHubsRequest; + + /** + * Creates a plain object from a ListHubsRequest message. Also converts values to other types if specified. + * @param message ListHubsRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.networkconnectivity.v1.ListHubsRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListHubsRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a ListHubsResponse. */ + interface IListHubsResponse { + + /** ListHubsResponse hubs */ + hubs?: (google.cloud.networkconnectivity.v1.IHub[]|null); + + /** ListHubsResponse nextPageToken */ + nextPageToken?: (string|null); + + /** ListHubsResponse unreachable */ + unreachable?: (string[]|null); + } + + /** Represents a ListHubsResponse. */ + class ListHubsResponse implements IListHubsResponse { + + /** + * Constructs a new ListHubsResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.networkconnectivity.v1.IListHubsResponse); + + /** ListHubsResponse hubs. */ + public hubs: google.cloud.networkconnectivity.v1.IHub[]; + + /** ListHubsResponse nextPageToken. */ + public nextPageToken: string; + + /** ListHubsResponse unreachable. */ + public unreachable: string[]; + + /** + * Creates a new ListHubsResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns ListHubsResponse instance + */ + public static create(properties?: google.cloud.networkconnectivity.v1.IListHubsResponse): google.cloud.networkconnectivity.v1.ListHubsResponse; + + /** + * Encodes the specified ListHubsResponse message. Does not implicitly {@link google.cloud.networkconnectivity.v1.ListHubsResponse.verify|verify} messages. + * @param message ListHubsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.networkconnectivity.v1.IListHubsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListHubsResponse message, length delimited. Does not implicitly {@link google.cloud.networkconnectivity.v1.ListHubsResponse.verify|verify} messages. + * @param message ListHubsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.networkconnectivity.v1.IListHubsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListHubsResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListHubsResponse + * @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.ListHubsResponse; + + /** + * Decodes a ListHubsResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListHubsResponse + * @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.ListHubsResponse; + + /** + * Verifies a ListHubsResponse 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 ListHubsResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListHubsResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.networkconnectivity.v1.ListHubsResponse; + + /** + * Creates a plain object from a ListHubsResponse message. Also converts values to other types if specified. + * @param message ListHubsResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.networkconnectivity.v1.ListHubsResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListHubsResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a GetHubRequest. */ + interface IGetHubRequest { + + /** GetHubRequest name */ + name?: (string|null); + } + + /** Represents a GetHubRequest. */ + class GetHubRequest implements IGetHubRequest { + + /** + * Constructs a new GetHubRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.networkconnectivity.v1.IGetHubRequest); + + /** GetHubRequest name. */ + public name: string; + + /** + * Creates a new GetHubRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns GetHubRequest instance + */ + public static create(properties?: google.cloud.networkconnectivity.v1.IGetHubRequest): google.cloud.networkconnectivity.v1.GetHubRequest; + + /** + * Encodes the specified GetHubRequest message. Does not implicitly {@link google.cloud.networkconnectivity.v1.GetHubRequest.verify|verify} messages. + * @param message GetHubRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.networkconnectivity.v1.IGetHubRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified GetHubRequest message, length delimited. Does not implicitly {@link google.cloud.networkconnectivity.v1.GetHubRequest.verify|verify} messages. + * @param message GetHubRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.networkconnectivity.v1.IGetHubRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a GetHubRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns GetHubRequest + * @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.GetHubRequest; + + /** + * Decodes a GetHubRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns GetHubRequest + * @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.GetHubRequest; + + /** + * Verifies a GetHubRequest 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 GetHubRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns GetHubRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.networkconnectivity.v1.GetHubRequest; + + /** + * Creates a plain object from a GetHubRequest message. Also converts values to other types if specified. + * @param message GetHubRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.networkconnectivity.v1.GetHubRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this GetHubRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a CreateHubRequest. */ + interface ICreateHubRequest { + + /** CreateHubRequest parent */ + parent?: (string|null); + + /** CreateHubRequest hubId */ + hubId?: (string|null); + + /** CreateHubRequest hub */ + hub?: (google.cloud.networkconnectivity.v1.IHub|null); + + /** CreateHubRequest requestId */ + requestId?: (string|null); + } + + /** Represents a CreateHubRequest. */ + class CreateHubRequest implements ICreateHubRequest { + + /** + * Constructs a new CreateHubRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.networkconnectivity.v1.ICreateHubRequest); + + /** CreateHubRequest parent. */ + public parent: string; + + /** CreateHubRequest hubId. */ + public hubId: string; + + /** CreateHubRequest hub. */ + public hub?: (google.cloud.networkconnectivity.v1.IHub|null); + + /** CreateHubRequest requestId. */ + public requestId: string; + + /** + * Creates a new CreateHubRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns CreateHubRequest instance + */ + public static create(properties?: google.cloud.networkconnectivity.v1.ICreateHubRequest): google.cloud.networkconnectivity.v1.CreateHubRequest; + + /** + * Encodes the specified CreateHubRequest message. Does not implicitly {@link google.cloud.networkconnectivity.v1.CreateHubRequest.verify|verify} messages. + * @param message CreateHubRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.networkconnectivity.v1.ICreateHubRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified CreateHubRequest message, length delimited. Does not implicitly {@link google.cloud.networkconnectivity.v1.CreateHubRequest.verify|verify} messages. + * @param message CreateHubRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.networkconnectivity.v1.ICreateHubRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a CreateHubRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns CreateHubRequest + * @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.CreateHubRequest; + + /** + * Decodes a CreateHubRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns CreateHubRequest + * @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.CreateHubRequest; + + /** + * Verifies a CreateHubRequest 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 CreateHubRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns CreateHubRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.networkconnectivity.v1.CreateHubRequest; + + /** + * Creates a plain object from a CreateHubRequest message. Also converts values to other types if specified. + * @param message CreateHubRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.networkconnectivity.v1.CreateHubRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this CreateHubRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of an UpdateHubRequest. */ + interface IUpdateHubRequest { + + /** UpdateHubRequest updateMask */ + updateMask?: (google.protobuf.IFieldMask|null); + + /** UpdateHubRequest hub */ + hub?: (google.cloud.networkconnectivity.v1.IHub|null); + + /** UpdateHubRequest requestId */ + requestId?: (string|null); + } + + /** Represents an UpdateHubRequest. */ + class UpdateHubRequest implements IUpdateHubRequest { + + /** + * Constructs a new UpdateHubRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.networkconnectivity.v1.IUpdateHubRequest); + + /** UpdateHubRequest updateMask. */ + public updateMask?: (google.protobuf.IFieldMask|null); + + /** UpdateHubRequest hub. */ + public hub?: (google.cloud.networkconnectivity.v1.IHub|null); + + /** UpdateHubRequest requestId. */ + public requestId: string; + + /** + * Creates a new UpdateHubRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns UpdateHubRequest instance + */ + public static create(properties?: google.cloud.networkconnectivity.v1.IUpdateHubRequest): google.cloud.networkconnectivity.v1.UpdateHubRequest; + + /** + * Encodes the specified UpdateHubRequest message. Does not implicitly {@link google.cloud.networkconnectivity.v1.UpdateHubRequest.verify|verify} messages. + * @param message UpdateHubRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.networkconnectivity.v1.IUpdateHubRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified UpdateHubRequest message, length delimited. Does not implicitly {@link google.cloud.networkconnectivity.v1.UpdateHubRequest.verify|verify} messages. + * @param message UpdateHubRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.networkconnectivity.v1.IUpdateHubRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an UpdateHubRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns UpdateHubRequest + * @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.UpdateHubRequest; + + /** + * Decodes an UpdateHubRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns UpdateHubRequest + * @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.UpdateHubRequest; + + /** + * Verifies an UpdateHubRequest 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 UpdateHubRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns UpdateHubRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.networkconnectivity.v1.UpdateHubRequest; + + /** + * Creates a plain object from an UpdateHubRequest message. Also converts values to other types if specified. + * @param message UpdateHubRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.networkconnectivity.v1.UpdateHubRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this UpdateHubRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a DeleteHubRequest. */ + interface IDeleteHubRequest { + + /** DeleteHubRequest name */ + name?: (string|null); + + /** DeleteHubRequest requestId */ + requestId?: (string|null); + } + + /** Represents a DeleteHubRequest. */ + class DeleteHubRequest implements IDeleteHubRequest { + + /** + * Constructs a new DeleteHubRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.networkconnectivity.v1.IDeleteHubRequest); + + /** DeleteHubRequest name. */ + public name: string; + + /** DeleteHubRequest requestId. */ + public requestId: string; + + /** + * Creates a new DeleteHubRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns DeleteHubRequest instance + */ + public static create(properties?: google.cloud.networkconnectivity.v1.IDeleteHubRequest): google.cloud.networkconnectivity.v1.DeleteHubRequest; + + /** + * Encodes the specified DeleteHubRequest message. Does not implicitly {@link google.cloud.networkconnectivity.v1.DeleteHubRequest.verify|verify} messages. + * @param message DeleteHubRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.networkconnectivity.v1.IDeleteHubRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DeleteHubRequest message, length delimited. Does not implicitly {@link google.cloud.networkconnectivity.v1.DeleteHubRequest.verify|verify} messages. + * @param message DeleteHubRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.networkconnectivity.v1.IDeleteHubRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DeleteHubRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DeleteHubRequest + * @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.DeleteHubRequest; + + /** + * Decodes a DeleteHubRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DeleteHubRequest + * @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.DeleteHubRequest; + + /** + * Verifies a DeleteHubRequest 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 DeleteHubRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DeleteHubRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.networkconnectivity.v1.DeleteHubRequest; + + /** + * Creates a plain object from a DeleteHubRequest message. Also converts values to other types if specified. + * @param message DeleteHubRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.networkconnectivity.v1.DeleteHubRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DeleteHubRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a ListSpokesRequest. */ + interface IListSpokesRequest { + + /** ListSpokesRequest parent */ + parent?: (string|null); + + /** ListSpokesRequest pageSize */ + pageSize?: (number|null); + + /** ListSpokesRequest pageToken */ + pageToken?: (string|null); + + /** ListSpokesRequest filter */ + filter?: (string|null); + + /** ListSpokesRequest orderBy */ + orderBy?: (string|null); + } + + /** Represents a ListSpokesRequest. */ + class ListSpokesRequest implements IListSpokesRequest { + + /** + * Constructs a new ListSpokesRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.networkconnectivity.v1.IListSpokesRequest); + + /** ListSpokesRequest parent. */ + public parent: string; + + /** ListSpokesRequest pageSize. */ + public pageSize: number; + + /** ListSpokesRequest pageToken. */ + public pageToken: string; + + /** ListSpokesRequest filter. */ + public filter: string; + + /** ListSpokesRequest orderBy. */ + public orderBy: string; + + /** + * Creates a new ListSpokesRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns ListSpokesRequest instance + */ + public static create(properties?: google.cloud.networkconnectivity.v1.IListSpokesRequest): google.cloud.networkconnectivity.v1.ListSpokesRequest; + + /** + * Encodes the specified ListSpokesRequest message. Does not implicitly {@link google.cloud.networkconnectivity.v1.ListSpokesRequest.verify|verify} messages. + * @param message ListSpokesRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.networkconnectivity.v1.IListSpokesRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListSpokesRequest message, length delimited. Does not implicitly {@link google.cloud.networkconnectivity.v1.ListSpokesRequest.verify|verify} messages. + * @param message ListSpokesRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.networkconnectivity.v1.IListSpokesRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListSpokesRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListSpokesRequest + * @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.ListSpokesRequest; + + /** + * Decodes a ListSpokesRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListSpokesRequest + * @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.ListSpokesRequest; + + /** + * Verifies a ListSpokesRequest 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 ListSpokesRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListSpokesRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.networkconnectivity.v1.ListSpokesRequest; + + /** + * Creates a plain object from a ListSpokesRequest message. Also converts values to other types if specified. + * @param message ListSpokesRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.networkconnectivity.v1.ListSpokesRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListSpokesRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a ListSpokesResponse. */ + interface IListSpokesResponse { + + /** ListSpokesResponse spokes */ + spokes?: (google.cloud.networkconnectivity.v1.ISpoke[]|null); + + /** ListSpokesResponse nextPageToken */ + nextPageToken?: (string|null); + + /** ListSpokesResponse unreachable */ + unreachable?: (string[]|null); + } + + /** Represents a ListSpokesResponse. */ + class ListSpokesResponse implements IListSpokesResponse { + + /** + * Constructs a new ListSpokesResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.networkconnectivity.v1.IListSpokesResponse); + + /** ListSpokesResponse spokes. */ + public spokes: google.cloud.networkconnectivity.v1.ISpoke[]; + + /** ListSpokesResponse nextPageToken. */ + public nextPageToken: string; + + /** ListSpokesResponse unreachable. */ + public unreachable: string[]; + + /** + * Creates a new ListSpokesResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns ListSpokesResponse instance + */ + public static create(properties?: google.cloud.networkconnectivity.v1.IListSpokesResponse): google.cloud.networkconnectivity.v1.ListSpokesResponse; + + /** + * Encodes the specified ListSpokesResponse message. Does not implicitly {@link google.cloud.networkconnectivity.v1.ListSpokesResponse.verify|verify} messages. + * @param message ListSpokesResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.networkconnectivity.v1.IListSpokesResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListSpokesResponse message, length delimited. Does not implicitly {@link google.cloud.networkconnectivity.v1.ListSpokesResponse.verify|verify} messages. + * @param message ListSpokesResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.networkconnectivity.v1.IListSpokesResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListSpokesResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListSpokesResponse + * @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.ListSpokesResponse; + + /** + * Decodes a ListSpokesResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListSpokesResponse + * @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.ListSpokesResponse; + + /** + * Verifies a ListSpokesResponse 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 ListSpokesResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListSpokesResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.networkconnectivity.v1.ListSpokesResponse; + + /** + * Creates a plain object from a ListSpokesResponse message. Also converts values to other types if specified. + * @param message ListSpokesResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.networkconnectivity.v1.ListSpokesResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListSpokesResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a GetSpokeRequest. */ + interface IGetSpokeRequest { + + /** GetSpokeRequest name */ + name?: (string|null); + } + + /** Represents a GetSpokeRequest. */ + class GetSpokeRequest implements IGetSpokeRequest { + + /** + * Constructs a new GetSpokeRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.networkconnectivity.v1.IGetSpokeRequest); + + /** GetSpokeRequest name. */ + public name: string; + + /** + * Creates a new GetSpokeRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns GetSpokeRequest instance + */ + public static create(properties?: google.cloud.networkconnectivity.v1.IGetSpokeRequest): google.cloud.networkconnectivity.v1.GetSpokeRequest; + + /** + * Encodes the specified GetSpokeRequest message. Does not implicitly {@link google.cloud.networkconnectivity.v1.GetSpokeRequest.verify|verify} messages. + * @param message GetSpokeRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.networkconnectivity.v1.IGetSpokeRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified GetSpokeRequest message, length delimited. Does not implicitly {@link google.cloud.networkconnectivity.v1.GetSpokeRequest.verify|verify} messages. + * @param message GetSpokeRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.networkconnectivity.v1.IGetSpokeRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a GetSpokeRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns GetSpokeRequest + * @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.GetSpokeRequest; + + /** + * Decodes a GetSpokeRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns GetSpokeRequest + * @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.GetSpokeRequest; + + /** + * Verifies a GetSpokeRequest 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 GetSpokeRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns GetSpokeRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.networkconnectivity.v1.GetSpokeRequest; + + /** + * Creates a plain object from a GetSpokeRequest message. Also converts values to other types if specified. + * @param message GetSpokeRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.networkconnectivity.v1.GetSpokeRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this GetSpokeRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a CreateSpokeRequest. */ + interface ICreateSpokeRequest { + + /** CreateSpokeRequest parent */ + parent?: (string|null); + + /** CreateSpokeRequest spokeId */ + spokeId?: (string|null); + + /** CreateSpokeRequest spoke */ + spoke?: (google.cloud.networkconnectivity.v1.ISpoke|null); + + /** CreateSpokeRequest requestId */ + requestId?: (string|null); + } + + /** Represents a CreateSpokeRequest. */ + class CreateSpokeRequest implements ICreateSpokeRequest { + + /** + * Constructs a new CreateSpokeRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.networkconnectivity.v1.ICreateSpokeRequest); + + /** CreateSpokeRequest parent. */ + public parent: string; + + /** CreateSpokeRequest spokeId. */ + public spokeId: string; + + /** CreateSpokeRequest spoke. */ + public spoke?: (google.cloud.networkconnectivity.v1.ISpoke|null); + + /** CreateSpokeRequest requestId. */ + public requestId: string; + + /** + * Creates a new CreateSpokeRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns CreateSpokeRequest instance + */ + public static create(properties?: google.cloud.networkconnectivity.v1.ICreateSpokeRequest): google.cloud.networkconnectivity.v1.CreateSpokeRequest; + + /** + * Encodes the specified CreateSpokeRequest message. Does not implicitly {@link google.cloud.networkconnectivity.v1.CreateSpokeRequest.verify|verify} messages. + * @param message CreateSpokeRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.networkconnectivity.v1.ICreateSpokeRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified CreateSpokeRequest message, length delimited. Does not implicitly {@link google.cloud.networkconnectivity.v1.CreateSpokeRequest.verify|verify} messages. + * @param message CreateSpokeRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.networkconnectivity.v1.ICreateSpokeRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a CreateSpokeRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns CreateSpokeRequest + * @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.CreateSpokeRequest; + + /** + * Decodes a CreateSpokeRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns CreateSpokeRequest + * @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.CreateSpokeRequest; + + /** + * Verifies a CreateSpokeRequest 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 CreateSpokeRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns CreateSpokeRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.networkconnectivity.v1.CreateSpokeRequest; + + /** + * Creates a plain object from a CreateSpokeRequest message. Also converts values to other types if specified. + * @param message CreateSpokeRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.networkconnectivity.v1.CreateSpokeRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this CreateSpokeRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of an UpdateSpokeRequest. */ + interface IUpdateSpokeRequest { + + /** UpdateSpokeRequest updateMask */ + updateMask?: (google.protobuf.IFieldMask|null); + + /** UpdateSpokeRequest spoke */ + spoke?: (google.cloud.networkconnectivity.v1.ISpoke|null); + + /** UpdateSpokeRequest requestId */ + requestId?: (string|null); + } + + /** Represents an UpdateSpokeRequest. */ + class UpdateSpokeRequest implements IUpdateSpokeRequest { + + /** + * Constructs a new UpdateSpokeRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.networkconnectivity.v1.IUpdateSpokeRequest); + + /** UpdateSpokeRequest updateMask. */ + public updateMask?: (google.protobuf.IFieldMask|null); + + /** UpdateSpokeRequest spoke. */ + public spoke?: (google.cloud.networkconnectivity.v1.ISpoke|null); + + /** UpdateSpokeRequest requestId. */ + public requestId: string; + + /** + * Creates a new UpdateSpokeRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns UpdateSpokeRequest instance + */ + public static create(properties?: google.cloud.networkconnectivity.v1.IUpdateSpokeRequest): google.cloud.networkconnectivity.v1.UpdateSpokeRequest; + + /** + * Encodes the specified UpdateSpokeRequest message. Does not implicitly {@link google.cloud.networkconnectivity.v1.UpdateSpokeRequest.verify|verify} messages. + * @param message UpdateSpokeRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.networkconnectivity.v1.IUpdateSpokeRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified UpdateSpokeRequest message, length delimited. Does not implicitly {@link google.cloud.networkconnectivity.v1.UpdateSpokeRequest.verify|verify} messages. + * @param message UpdateSpokeRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.networkconnectivity.v1.IUpdateSpokeRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an UpdateSpokeRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns UpdateSpokeRequest + * @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.UpdateSpokeRequest; + + /** + * Decodes an UpdateSpokeRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns UpdateSpokeRequest + * @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.UpdateSpokeRequest; + + /** + * Verifies an UpdateSpokeRequest 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 UpdateSpokeRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns UpdateSpokeRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.networkconnectivity.v1.UpdateSpokeRequest; + + /** + * Creates a plain object from an UpdateSpokeRequest message. Also converts values to other types if specified. + * @param message UpdateSpokeRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.networkconnectivity.v1.UpdateSpokeRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this UpdateSpokeRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a DeleteSpokeRequest. */ + interface IDeleteSpokeRequest { + + /** DeleteSpokeRequest name */ + name?: (string|null); + + /** DeleteSpokeRequest requestId */ + requestId?: (string|null); + } + + /** Represents a DeleteSpokeRequest. */ + class DeleteSpokeRequest implements IDeleteSpokeRequest { + + /** + * Constructs a new DeleteSpokeRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.networkconnectivity.v1.IDeleteSpokeRequest); + + /** DeleteSpokeRequest name. */ + public name: string; + + /** DeleteSpokeRequest requestId. */ + public requestId: string; + + /** + * Creates a new DeleteSpokeRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns DeleteSpokeRequest instance + */ + public static create(properties?: google.cloud.networkconnectivity.v1.IDeleteSpokeRequest): google.cloud.networkconnectivity.v1.DeleteSpokeRequest; + + /** + * Encodes the specified DeleteSpokeRequest message. Does not implicitly {@link google.cloud.networkconnectivity.v1.DeleteSpokeRequest.verify|verify} messages. + * @param message DeleteSpokeRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.networkconnectivity.v1.IDeleteSpokeRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DeleteSpokeRequest message, length delimited. Does not implicitly {@link google.cloud.networkconnectivity.v1.DeleteSpokeRequest.verify|verify} messages. + * @param message DeleteSpokeRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.networkconnectivity.v1.IDeleteSpokeRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DeleteSpokeRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DeleteSpokeRequest + * @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.DeleteSpokeRequest; + + /** + * Decodes a DeleteSpokeRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DeleteSpokeRequest + * @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.DeleteSpokeRequest; + + /** + * Verifies a DeleteSpokeRequest 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 DeleteSpokeRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DeleteSpokeRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.networkconnectivity.v1.DeleteSpokeRequest; + + /** + * Creates a plain object from a DeleteSpokeRequest message. Also converts values to other types if specified. + * @param message DeleteSpokeRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.networkconnectivity.v1.DeleteSpokeRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DeleteSpokeRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a DeactivateSpokeRequest. */ + interface IDeactivateSpokeRequest { + + /** DeactivateSpokeRequest name */ + name?: (string|null); + + /** DeactivateSpokeRequest requestId */ + requestId?: (string|null); + } + + /** Represents a DeactivateSpokeRequest. */ + class DeactivateSpokeRequest implements IDeactivateSpokeRequest { + + /** + * Constructs a new DeactivateSpokeRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.networkconnectivity.v1.IDeactivateSpokeRequest); + + /** DeactivateSpokeRequest name. */ + public name: string; + + /** DeactivateSpokeRequest requestId. */ + public requestId: string; + + /** + * Creates a new DeactivateSpokeRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns DeactivateSpokeRequest instance + */ + public static create(properties?: google.cloud.networkconnectivity.v1.IDeactivateSpokeRequest): google.cloud.networkconnectivity.v1.DeactivateSpokeRequest; + + /** + * Encodes the specified DeactivateSpokeRequest message. Does not implicitly {@link google.cloud.networkconnectivity.v1.DeactivateSpokeRequest.verify|verify} messages. + * @param message DeactivateSpokeRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.networkconnectivity.v1.IDeactivateSpokeRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DeactivateSpokeRequest message, length delimited. Does not implicitly {@link google.cloud.networkconnectivity.v1.DeactivateSpokeRequest.verify|verify} messages. + * @param message DeactivateSpokeRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.networkconnectivity.v1.IDeactivateSpokeRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DeactivateSpokeRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DeactivateSpokeRequest + * @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.DeactivateSpokeRequest; + + /** + * Decodes a DeactivateSpokeRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DeactivateSpokeRequest + * @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.DeactivateSpokeRequest; + + /** + * Verifies a DeactivateSpokeRequest 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 DeactivateSpokeRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DeactivateSpokeRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.networkconnectivity.v1.DeactivateSpokeRequest; + + /** + * Creates a plain object from a DeactivateSpokeRequest message. Also converts values to other types if specified. + * @param message DeactivateSpokeRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.networkconnectivity.v1.DeactivateSpokeRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DeactivateSpokeRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of an ActivateSpokeRequest. */ + interface IActivateSpokeRequest { + + /** ActivateSpokeRequest name */ + name?: (string|null); + + /** ActivateSpokeRequest requestId */ + requestId?: (string|null); + } + + /** Represents an ActivateSpokeRequest. */ + class ActivateSpokeRequest implements IActivateSpokeRequest { + + /** + * Constructs a new ActivateSpokeRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.networkconnectivity.v1.IActivateSpokeRequest); + + /** ActivateSpokeRequest name. */ + public name: string; + + /** ActivateSpokeRequest requestId. */ + public requestId: string; + + /** + * Creates a new ActivateSpokeRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns ActivateSpokeRequest instance + */ + public static create(properties?: google.cloud.networkconnectivity.v1.IActivateSpokeRequest): google.cloud.networkconnectivity.v1.ActivateSpokeRequest; + + /** + * Encodes the specified ActivateSpokeRequest message. Does not implicitly {@link google.cloud.networkconnectivity.v1.ActivateSpokeRequest.verify|verify} messages. + * @param message ActivateSpokeRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.networkconnectivity.v1.IActivateSpokeRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ActivateSpokeRequest message, length delimited. Does not implicitly {@link google.cloud.networkconnectivity.v1.ActivateSpokeRequest.verify|verify} messages. + * @param message ActivateSpokeRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.networkconnectivity.v1.IActivateSpokeRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an ActivateSpokeRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ActivateSpokeRequest + * @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.ActivateSpokeRequest; + + /** + * Decodes an ActivateSpokeRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ActivateSpokeRequest + * @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.ActivateSpokeRequest; + + /** + * Verifies an ActivateSpokeRequest 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 ActivateSpokeRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ActivateSpokeRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.networkconnectivity.v1.ActivateSpokeRequest; + + /** + * Creates a plain object from an ActivateSpokeRequest message. Also converts values to other types if specified. + * @param message ActivateSpokeRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.networkconnectivity.v1.ActivateSpokeRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ActivateSpokeRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a LinkedVpnTunnels. */ + interface ILinkedVpnTunnels { + + /** LinkedVpnTunnels uris */ + uris?: (string[]|null); + + /** LinkedVpnTunnels siteToSiteDataTransfer */ + siteToSiteDataTransfer?: (boolean|null); + } + + /** Represents a LinkedVpnTunnels. */ + class LinkedVpnTunnels implements ILinkedVpnTunnels { + + /** + * Constructs a new LinkedVpnTunnels. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.networkconnectivity.v1.ILinkedVpnTunnels); + + /** LinkedVpnTunnels uris. */ + public uris: string[]; + + /** LinkedVpnTunnels siteToSiteDataTransfer. */ + public siteToSiteDataTransfer: boolean; + + /** + * Creates a new LinkedVpnTunnels instance using the specified properties. + * @param [properties] Properties to set + * @returns LinkedVpnTunnels instance + */ + public static create(properties?: google.cloud.networkconnectivity.v1.ILinkedVpnTunnels): google.cloud.networkconnectivity.v1.LinkedVpnTunnels; + + /** + * Encodes the specified LinkedVpnTunnels message. Does not implicitly {@link google.cloud.networkconnectivity.v1.LinkedVpnTunnels.verify|verify} messages. + * @param message LinkedVpnTunnels message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.networkconnectivity.v1.ILinkedVpnTunnels, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified LinkedVpnTunnels message, length delimited. Does not implicitly {@link google.cloud.networkconnectivity.v1.LinkedVpnTunnels.verify|verify} messages. + * @param message LinkedVpnTunnels message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.networkconnectivity.v1.ILinkedVpnTunnels, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a LinkedVpnTunnels message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns LinkedVpnTunnels + * @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.LinkedVpnTunnels; + + /** + * Decodes a LinkedVpnTunnels message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns LinkedVpnTunnels + * @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.LinkedVpnTunnels; + + /** + * Verifies a LinkedVpnTunnels 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 LinkedVpnTunnels message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns LinkedVpnTunnels + */ + public static fromObject(object: { [k: string]: any }): google.cloud.networkconnectivity.v1.LinkedVpnTunnels; + + /** + * Creates a plain object from a LinkedVpnTunnels message. Also converts values to other types if specified. + * @param message LinkedVpnTunnels + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.networkconnectivity.v1.LinkedVpnTunnels, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this LinkedVpnTunnels to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a LinkedInterconnectAttachments. */ + interface ILinkedInterconnectAttachments { + + /** LinkedInterconnectAttachments uris */ + uris?: (string[]|null); + + /** LinkedInterconnectAttachments siteToSiteDataTransfer */ + siteToSiteDataTransfer?: (boolean|null); + } + + /** Represents a LinkedInterconnectAttachments. */ + class LinkedInterconnectAttachments implements ILinkedInterconnectAttachments { + + /** + * Constructs a new LinkedInterconnectAttachments. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.networkconnectivity.v1.ILinkedInterconnectAttachments); + + /** LinkedInterconnectAttachments uris. */ + public uris: string[]; + + /** LinkedInterconnectAttachments siteToSiteDataTransfer. */ + public siteToSiteDataTransfer: boolean; + + /** + * Creates a new LinkedInterconnectAttachments instance using the specified properties. + * @param [properties] Properties to set + * @returns LinkedInterconnectAttachments instance + */ + public static create(properties?: google.cloud.networkconnectivity.v1.ILinkedInterconnectAttachments): google.cloud.networkconnectivity.v1.LinkedInterconnectAttachments; + + /** + * Encodes the specified LinkedInterconnectAttachments message. Does not implicitly {@link google.cloud.networkconnectivity.v1.LinkedInterconnectAttachments.verify|verify} messages. + * @param message LinkedInterconnectAttachments message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.networkconnectivity.v1.ILinkedInterconnectAttachments, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified LinkedInterconnectAttachments message, length delimited. Does not implicitly {@link google.cloud.networkconnectivity.v1.LinkedInterconnectAttachments.verify|verify} messages. + * @param message LinkedInterconnectAttachments message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.networkconnectivity.v1.ILinkedInterconnectAttachments, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a LinkedInterconnectAttachments message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns LinkedInterconnectAttachments + * @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.LinkedInterconnectAttachments; + + /** + * Decodes a LinkedInterconnectAttachments message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns LinkedInterconnectAttachments + * @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.LinkedInterconnectAttachments; + + /** + * Verifies a LinkedInterconnectAttachments 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 LinkedInterconnectAttachments message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns LinkedInterconnectAttachments + */ + public static fromObject(object: { [k: string]: any }): google.cloud.networkconnectivity.v1.LinkedInterconnectAttachments; + + /** + * Creates a plain object from a LinkedInterconnectAttachments message. Also converts values to other types if specified. + * @param message LinkedInterconnectAttachments + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.networkconnectivity.v1.LinkedInterconnectAttachments, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this LinkedInterconnectAttachments to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a LinkedRouterApplianceInstances. */ + interface ILinkedRouterApplianceInstances { + + /** LinkedRouterApplianceInstances instances */ + instances?: (google.cloud.networkconnectivity.v1.IRouterApplianceInstance[]|null); + + /** LinkedRouterApplianceInstances siteToSiteDataTransfer */ + siteToSiteDataTransfer?: (boolean|null); + } + + /** Represents a LinkedRouterApplianceInstances. */ + class LinkedRouterApplianceInstances implements ILinkedRouterApplianceInstances { + + /** + * Constructs a new LinkedRouterApplianceInstances. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.networkconnectivity.v1.ILinkedRouterApplianceInstances); + + /** LinkedRouterApplianceInstances instances. */ + public instances: google.cloud.networkconnectivity.v1.IRouterApplianceInstance[]; + + /** LinkedRouterApplianceInstances siteToSiteDataTransfer. */ + public siteToSiteDataTransfer: boolean; + + /** + * Creates a new LinkedRouterApplianceInstances instance using the specified properties. + * @param [properties] Properties to set + * @returns LinkedRouterApplianceInstances instance + */ + public static create(properties?: google.cloud.networkconnectivity.v1.ILinkedRouterApplianceInstances): google.cloud.networkconnectivity.v1.LinkedRouterApplianceInstances; + + /** + * Encodes the specified LinkedRouterApplianceInstances message. Does not implicitly {@link google.cloud.networkconnectivity.v1.LinkedRouterApplianceInstances.verify|verify} messages. + * @param message LinkedRouterApplianceInstances message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.networkconnectivity.v1.ILinkedRouterApplianceInstances, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified LinkedRouterApplianceInstances message, length delimited. Does not implicitly {@link google.cloud.networkconnectivity.v1.LinkedRouterApplianceInstances.verify|verify} messages. + * @param message LinkedRouterApplianceInstances message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.networkconnectivity.v1.ILinkedRouterApplianceInstances, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a LinkedRouterApplianceInstances message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns LinkedRouterApplianceInstances + * @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.LinkedRouterApplianceInstances; + + /** + * Decodes a LinkedRouterApplianceInstances message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns LinkedRouterApplianceInstances + * @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.LinkedRouterApplianceInstances; + + /** + * Verifies a LinkedRouterApplianceInstances 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 LinkedRouterApplianceInstances message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns LinkedRouterApplianceInstances + */ + public static fromObject(object: { [k: string]: any }): google.cloud.networkconnectivity.v1.LinkedRouterApplianceInstances; + + /** + * Creates a plain object from a LinkedRouterApplianceInstances message. Also converts values to other types if specified. + * @param message LinkedRouterApplianceInstances + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.networkconnectivity.v1.LinkedRouterApplianceInstances, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this LinkedRouterApplianceInstances to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a RouterApplianceInstance. */ + interface IRouterApplianceInstance { + + /** RouterApplianceInstance virtualMachine */ + virtualMachine?: (string|null); + + /** RouterApplianceInstance ipAddress */ + ipAddress?: (string|null); + } + + /** Represents a RouterApplianceInstance. */ + class RouterApplianceInstance implements IRouterApplianceInstance { + + /** + * Constructs a new RouterApplianceInstance. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.networkconnectivity.v1.IRouterApplianceInstance); + + /** RouterApplianceInstance virtualMachine. */ + public virtualMachine: string; + + /** RouterApplianceInstance ipAddress. */ + public ipAddress: string; + + /** + * Creates a new RouterApplianceInstance instance using the specified properties. + * @param [properties] Properties to set + * @returns RouterApplianceInstance instance + */ + public static create(properties?: google.cloud.networkconnectivity.v1.IRouterApplianceInstance): google.cloud.networkconnectivity.v1.RouterApplianceInstance; + + /** + * Encodes the specified RouterApplianceInstance message. Does not implicitly {@link google.cloud.networkconnectivity.v1.RouterApplianceInstance.verify|verify} messages. + * @param message RouterApplianceInstance message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.networkconnectivity.v1.IRouterApplianceInstance, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified RouterApplianceInstance message, length delimited. Does not implicitly {@link google.cloud.networkconnectivity.v1.RouterApplianceInstance.verify|verify} messages. + * @param message RouterApplianceInstance message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.networkconnectivity.v1.IRouterApplianceInstance, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a RouterApplianceInstance message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns RouterApplianceInstance + * @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.RouterApplianceInstance; + + /** + * Decodes a RouterApplianceInstance message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns RouterApplianceInstance + * @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.RouterApplianceInstance; + + /** + * Verifies a RouterApplianceInstance 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 RouterApplianceInstance message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns RouterApplianceInstance + */ + public static fromObject(object: { [k: string]: any }): google.cloud.networkconnectivity.v1.RouterApplianceInstance; + + /** + * Creates a plain object from a RouterApplianceInstance message. Also converts values to other types if specified. + * @param message RouterApplianceInstance + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.networkconnectivity.v1.RouterApplianceInstance, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this RouterApplianceInstance to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + } + /** Namespace v1alpha1. */ namespace v1alpha1 { diff --git a/protos/protos.js b/protos/protos.js index e5a6c55..e2f7669 100644 --- a/protos/protos.js +++ b/protos/protos.js @@ -57,6 +57,5879 @@ */ var networkconnectivity = {}; + networkconnectivity.v1 = (function() { + + /** + * Namespace v1. + * @memberof google.cloud.networkconnectivity + * @namespace + */ + var v1 = {}; + + v1.OperationMetadata = (function() { + + /** + * Properties of an OperationMetadata. + * @memberof google.cloud.networkconnectivity.v1 + * @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.v1 + * @classdesc Represents an OperationMetadata. + * @implements IOperationMetadata + * @constructor + * @param {google.cloud.networkconnectivity.v1.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.v1.OperationMetadata + * @instance + */ + OperationMetadata.prototype.createTime = null; + + /** + * OperationMetadata endTime. + * @member {google.protobuf.ITimestamp|null|undefined} endTime + * @memberof google.cloud.networkconnectivity.v1.OperationMetadata + * @instance + */ + OperationMetadata.prototype.endTime = null; + + /** + * OperationMetadata target. + * @member {string} target + * @memberof google.cloud.networkconnectivity.v1.OperationMetadata + * @instance + */ + OperationMetadata.prototype.target = ""; + + /** + * OperationMetadata verb. + * @member {string} verb + * @memberof google.cloud.networkconnectivity.v1.OperationMetadata + * @instance + */ + OperationMetadata.prototype.verb = ""; + + /** + * OperationMetadata statusMessage. + * @member {string} statusMessage + * @memberof google.cloud.networkconnectivity.v1.OperationMetadata + * @instance + */ + OperationMetadata.prototype.statusMessage = ""; + + /** + * OperationMetadata requestedCancellation. + * @member {boolean} requestedCancellation + * @memberof google.cloud.networkconnectivity.v1.OperationMetadata + * @instance + */ + OperationMetadata.prototype.requestedCancellation = false; + + /** + * OperationMetadata apiVersion. + * @member {string} apiVersion + * @memberof google.cloud.networkconnectivity.v1.OperationMetadata + * @instance + */ + OperationMetadata.prototype.apiVersion = ""; + + /** + * Creates a new OperationMetadata instance using the specified properties. + * @function create + * @memberof google.cloud.networkconnectivity.v1.OperationMetadata + * @static + * @param {google.cloud.networkconnectivity.v1.IOperationMetadata=} [properties] Properties to set + * @returns {google.cloud.networkconnectivity.v1.OperationMetadata} OperationMetadata instance + */ + OperationMetadata.create = function create(properties) { + return new OperationMetadata(properties); + }; + + /** + * Encodes the specified OperationMetadata message. Does not implicitly {@link google.cloud.networkconnectivity.v1.OperationMetadata.verify|verify} messages. + * @function encode + * @memberof google.cloud.networkconnectivity.v1.OperationMetadata + * @static + * @param {google.cloud.networkconnectivity.v1.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.v1.OperationMetadata.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.networkconnectivity.v1.OperationMetadata + * @static + * @param {google.cloud.networkconnectivity.v1.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.v1.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.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.v1.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.v1.OperationMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.networkconnectivity.v1.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.v1.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.v1.OperationMetadata + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.networkconnectivity.v1.OperationMetadata} OperationMetadata + */ + OperationMetadata.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.networkconnectivity.v1.OperationMetadata) + return object; + var message = new $root.google.cloud.networkconnectivity.v1.OperationMetadata(); + if (object.createTime != null) { + if (typeof object.createTime !== "object") + throw TypeError(".google.cloud.networkconnectivity.v1.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.v1.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.v1.OperationMetadata + * @static + * @param {google.cloud.networkconnectivity.v1.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.v1.OperationMetadata + * @instance + * @returns {Object.} JSON object + */ + OperationMetadata.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return OperationMetadata; + })(); + + v1.HubService = (function() { + + /** + * Constructs a new HubService service. + * @memberof google.cloud.networkconnectivity.v1 + * @classdesc Represents a HubService + * @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 HubService(rpcImpl, requestDelimited, responseDelimited) { + $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); + } + + (HubService.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = HubService; + + /** + * Creates new HubService service using the specified rpc implementation. + * @function create + * @memberof google.cloud.networkconnectivity.v1.HubService + * @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 {HubService} RPC service. Useful where requests and/or responses are streamed. + */ + HubService.create = function create(rpcImpl, requestDelimited, responseDelimited) { + return new this(rpcImpl, requestDelimited, responseDelimited); + }; + + /** + * Callback as used by {@link google.cloud.networkconnectivity.v1.HubService#listHubs}. + * @memberof google.cloud.networkconnectivity.v1.HubService + * @typedef ListHubsCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.networkconnectivity.v1.ListHubsResponse} [response] ListHubsResponse + */ + + /** + * Calls ListHubs. + * @function listHubs + * @memberof google.cloud.networkconnectivity.v1.HubService + * @instance + * @param {google.cloud.networkconnectivity.v1.IListHubsRequest} request ListHubsRequest message or plain object + * @param {google.cloud.networkconnectivity.v1.HubService.ListHubsCallback} callback Node-style callback called with the error, if any, and ListHubsResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(HubService.prototype.listHubs = function listHubs(request, callback) { + return this.rpcCall(listHubs, $root.google.cloud.networkconnectivity.v1.ListHubsRequest, $root.google.cloud.networkconnectivity.v1.ListHubsResponse, request, callback); + }, "name", { value: "ListHubs" }); + + /** + * Calls ListHubs. + * @function listHubs + * @memberof google.cloud.networkconnectivity.v1.HubService + * @instance + * @param {google.cloud.networkconnectivity.v1.IListHubsRequest} request ListHubsRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.networkconnectivity.v1.HubService#getHub}. + * @memberof google.cloud.networkconnectivity.v1.HubService + * @typedef GetHubCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.networkconnectivity.v1.Hub} [response] Hub + */ + + /** + * Calls GetHub. + * @function getHub + * @memberof google.cloud.networkconnectivity.v1.HubService + * @instance + * @param {google.cloud.networkconnectivity.v1.IGetHubRequest} request GetHubRequest message or plain object + * @param {google.cloud.networkconnectivity.v1.HubService.GetHubCallback} callback Node-style callback called with the error, if any, and Hub + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(HubService.prototype.getHub = function getHub(request, callback) { + return this.rpcCall(getHub, $root.google.cloud.networkconnectivity.v1.GetHubRequest, $root.google.cloud.networkconnectivity.v1.Hub, request, callback); + }, "name", { value: "GetHub" }); + + /** + * Calls GetHub. + * @function getHub + * @memberof google.cloud.networkconnectivity.v1.HubService + * @instance + * @param {google.cloud.networkconnectivity.v1.IGetHubRequest} request GetHubRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.networkconnectivity.v1.HubService#createHub}. + * @memberof google.cloud.networkconnectivity.v1.HubService + * @typedef CreateHubCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls CreateHub. + * @function createHub + * @memberof google.cloud.networkconnectivity.v1.HubService + * @instance + * @param {google.cloud.networkconnectivity.v1.ICreateHubRequest} request CreateHubRequest message or plain object + * @param {google.cloud.networkconnectivity.v1.HubService.CreateHubCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(HubService.prototype.createHub = function createHub(request, callback) { + return this.rpcCall(createHub, $root.google.cloud.networkconnectivity.v1.CreateHubRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "CreateHub" }); + + /** + * Calls CreateHub. + * @function createHub + * @memberof google.cloud.networkconnectivity.v1.HubService + * @instance + * @param {google.cloud.networkconnectivity.v1.ICreateHubRequest} request CreateHubRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.networkconnectivity.v1.HubService#updateHub}. + * @memberof google.cloud.networkconnectivity.v1.HubService + * @typedef UpdateHubCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls UpdateHub. + * @function updateHub + * @memberof google.cloud.networkconnectivity.v1.HubService + * @instance + * @param {google.cloud.networkconnectivity.v1.IUpdateHubRequest} request UpdateHubRequest message or plain object + * @param {google.cloud.networkconnectivity.v1.HubService.UpdateHubCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(HubService.prototype.updateHub = function updateHub(request, callback) { + return this.rpcCall(updateHub, $root.google.cloud.networkconnectivity.v1.UpdateHubRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "UpdateHub" }); + + /** + * Calls UpdateHub. + * @function updateHub + * @memberof google.cloud.networkconnectivity.v1.HubService + * @instance + * @param {google.cloud.networkconnectivity.v1.IUpdateHubRequest} request UpdateHubRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.networkconnectivity.v1.HubService#deleteHub}. + * @memberof google.cloud.networkconnectivity.v1.HubService + * @typedef DeleteHubCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls DeleteHub. + * @function deleteHub + * @memberof google.cloud.networkconnectivity.v1.HubService + * @instance + * @param {google.cloud.networkconnectivity.v1.IDeleteHubRequest} request DeleteHubRequest message or plain object + * @param {google.cloud.networkconnectivity.v1.HubService.DeleteHubCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(HubService.prototype.deleteHub = function deleteHub(request, callback) { + return this.rpcCall(deleteHub, $root.google.cloud.networkconnectivity.v1.DeleteHubRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "DeleteHub" }); + + /** + * Calls DeleteHub. + * @function deleteHub + * @memberof google.cloud.networkconnectivity.v1.HubService + * @instance + * @param {google.cloud.networkconnectivity.v1.IDeleteHubRequest} request DeleteHubRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.networkconnectivity.v1.HubService#listSpokes}. + * @memberof google.cloud.networkconnectivity.v1.HubService + * @typedef ListSpokesCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.networkconnectivity.v1.ListSpokesResponse} [response] ListSpokesResponse + */ + + /** + * Calls ListSpokes. + * @function listSpokes + * @memberof google.cloud.networkconnectivity.v1.HubService + * @instance + * @param {google.cloud.networkconnectivity.v1.IListSpokesRequest} request ListSpokesRequest message or plain object + * @param {google.cloud.networkconnectivity.v1.HubService.ListSpokesCallback} callback Node-style callback called with the error, if any, and ListSpokesResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(HubService.prototype.listSpokes = function listSpokes(request, callback) { + return this.rpcCall(listSpokes, $root.google.cloud.networkconnectivity.v1.ListSpokesRequest, $root.google.cloud.networkconnectivity.v1.ListSpokesResponse, request, callback); + }, "name", { value: "ListSpokes" }); + + /** + * Calls ListSpokes. + * @function listSpokes + * @memberof google.cloud.networkconnectivity.v1.HubService + * @instance + * @param {google.cloud.networkconnectivity.v1.IListSpokesRequest} request ListSpokesRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.networkconnectivity.v1.HubService#getSpoke}. + * @memberof google.cloud.networkconnectivity.v1.HubService + * @typedef GetSpokeCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.networkconnectivity.v1.Spoke} [response] Spoke + */ + + /** + * Calls GetSpoke. + * @function getSpoke + * @memberof google.cloud.networkconnectivity.v1.HubService + * @instance + * @param {google.cloud.networkconnectivity.v1.IGetSpokeRequest} request GetSpokeRequest message or plain object + * @param {google.cloud.networkconnectivity.v1.HubService.GetSpokeCallback} callback Node-style callback called with the error, if any, and Spoke + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(HubService.prototype.getSpoke = function getSpoke(request, callback) { + return this.rpcCall(getSpoke, $root.google.cloud.networkconnectivity.v1.GetSpokeRequest, $root.google.cloud.networkconnectivity.v1.Spoke, request, callback); + }, "name", { value: "GetSpoke" }); + + /** + * Calls GetSpoke. + * @function getSpoke + * @memberof google.cloud.networkconnectivity.v1.HubService + * @instance + * @param {google.cloud.networkconnectivity.v1.IGetSpokeRequest} request GetSpokeRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.networkconnectivity.v1.HubService#createSpoke}. + * @memberof google.cloud.networkconnectivity.v1.HubService + * @typedef CreateSpokeCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls CreateSpoke. + * @function createSpoke + * @memberof google.cloud.networkconnectivity.v1.HubService + * @instance + * @param {google.cloud.networkconnectivity.v1.ICreateSpokeRequest} request CreateSpokeRequest message or plain object + * @param {google.cloud.networkconnectivity.v1.HubService.CreateSpokeCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(HubService.prototype.createSpoke = function createSpoke(request, callback) { + return this.rpcCall(createSpoke, $root.google.cloud.networkconnectivity.v1.CreateSpokeRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "CreateSpoke" }); + + /** + * Calls CreateSpoke. + * @function createSpoke + * @memberof google.cloud.networkconnectivity.v1.HubService + * @instance + * @param {google.cloud.networkconnectivity.v1.ICreateSpokeRequest} request CreateSpokeRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.networkconnectivity.v1.HubService#updateSpoke}. + * @memberof google.cloud.networkconnectivity.v1.HubService + * @typedef UpdateSpokeCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls UpdateSpoke. + * @function updateSpoke + * @memberof google.cloud.networkconnectivity.v1.HubService + * @instance + * @param {google.cloud.networkconnectivity.v1.IUpdateSpokeRequest} request UpdateSpokeRequest message or plain object + * @param {google.cloud.networkconnectivity.v1.HubService.UpdateSpokeCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(HubService.prototype.updateSpoke = function updateSpoke(request, callback) { + return this.rpcCall(updateSpoke, $root.google.cloud.networkconnectivity.v1.UpdateSpokeRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "UpdateSpoke" }); + + /** + * Calls UpdateSpoke. + * @function updateSpoke + * @memberof google.cloud.networkconnectivity.v1.HubService + * @instance + * @param {google.cloud.networkconnectivity.v1.IUpdateSpokeRequest} request UpdateSpokeRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.networkconnectivity.v1.HubService#deactivateSpoke}. + * @memberof google.cloud.networkconnectivity.v1.HubService + * @typedef DeactivateSpokeCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls DeactivateSpoke. + * @function deactivateSpoke + * @memberof google.cloud.networkconnectivity.v1.HubService + * @instance + * @param {google.cloud.networkconnectivity.v1.IDeactivateSpokeRequest} request DeactivateSpokeRequest message or plain object + * @param {google.cloud.networkconnectivity.v1.HubService.DeactivateSpokeCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(HubService.prototype.deactivateSpoke = function deactivateSpoke(request, callback) { + return this.rpcCall(deactivateSpoke, $root.google.cloud.networkconnectivity.v1.DeactivateSpokeRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "DeactivateSpoke" }); + + /** + * Calls DeactivateSpoke. + * @function deactivateSpoke + * @memberof google.cloud.networkconnectivity.v1.HubService + * @instance + * @param {google.cloud.networkconnectivity.v1.IDeactivateSpokeRequest} request DeactivateSpokeRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.networkconnectivity.v1.HubService#activateSpoke}. + * @memberof google.cloud.networkconnectivity.v1.HubService + * @typedef ActivateSpokeCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls ActivateSpoke. + * @function activateSpoke + * @memberof google.cloud.networkconnectivity.v1.HubService + * @instance + * @param {google.cloud.networkconnectivity.v1.IActivateSpokeRequest} request ActivateSpokeRequest message or plain object + * @param {google.cloud.networkconnectivity.v1.HubService.ActivateSpokeCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(HubService.prototype.activateSpoke = function activateSpoke(request, callback) { + return this.rpcCall(activateSpoke, $root.google.cloud.networkconnectivity.v1.ActivateSpokeRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "ActivateSpoke" }); + + /** + * Calls ActivateSpoke. + * @function activateSpoke + * @memberof google.cloud.networkconnectivity.v1.HubService + * @instance + * @param {google.cloud.networkconnectivity.v1.IActivateSpokeRequest} request ActivateSpokeRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.networkconnectivity.v1.HubService#deleteSpoke}. + * @memberof google.cloud.networkconnectivity.v1.HubService + * @typedef DeleteSpokeCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls DeleteSpoke. + * @function deleteSpoke + * @memberof google.cloud.networkconnectivity.v1.HubService + * @instance + * @param {google.cloud.networkconnectivity.v1.IDeleteSpokeRequest} request DeleteSpokeRequest message or plain object + * @param {google.cloud.networkconnectivity.v1.HubService.DeleteSpokeCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(HubService.prototype.deleteSpoke = function deleteSpoke(request, callback) { + return this.rpcCall(deleteSpoke, $root.google.cloud.networkconnectivity.v1.DeleteSpokeRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "DeleteSpoke" }); + + /** + * Calls DeleteSpoke. + * @function deleteSpoke + * @memberof google.cloud.networkconnectivity.v1.HubService + * @instance + * @param {google.cloud.networkconnectivity.v1.IDeleteSpokeRequest} request DeleteSpokeRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + return HubService; + })(); + + v1.Hub = (function() { + + /** + * Properties of a Hub. + * @memberof google.cloud.networkconnectivity.v1 + * @interface IHub + * @property {string|null} [name] Hub name + * @property {google.protobuf.ITimestamp|null} [createTime] Hub createTime + * @property {google.protobuf.ITimestamp|null} [updateTime] Hub updateTime + * @property {Object.|null} [labels] Hub labels + * @property {string|null} [description] Hub description + * @property {string|null} [uniqueId] Hub uniqueId + * @property {google.cloud.networkconnectivity.v1.State|null} [state] Hub state + */ + + /** + * Constructs a new Hub. + * @memberof google.cloud.networkconnectivity.v1 + * @classdesc Represents a Hub. + * @implements IHub + * @constructor + * @param {google.cloud.networkconnectivity.v1.IHub=} [properties] Properties to set + */ + function Hub(properties) { + this.labels = {}; + 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]]; + } + + /** + * Hub name. + * @member {string} name + * @memberof google.cloud.networkconnectivity.v1.Hub + * @instance + */ + Hub.prototype.name = ""; + + /** + * Hub createTime. + * @member {google.protobuf.ITimestamp|null|undefined} createTime + * @memberof google.cloud.networkconnectivity.v1.Hub + * @instance + */ + Hub.prototype.createTime = null; + + /** + * Hub updateTime. + * @member {google.protobuf.ITimestamp|null|undefined} updateTime + * @memberof google.cloud.networkconnectivity.v1.Hub + * @instance + */ + Hub.prototype.updateTime = null; + + /** + * Hub labels. + * @member {Object.} labels + * @memberof google.cloud.networkconnectivity.v1.Hub + * @instance + */ + Hub.prototype.labels = $util.emptyObject; + + /** + * Hub description. + * @member {string} description + * @memberof google.cloud.networkconnectivity.v1.Hub + * @instance + */ + Hub.prototype.description = ""; + + /** + * Hub uniqueId. + * @member {string} uniqueId + * @memberof google.cloud.networkconnectivity.v1.Hub + * @instance + */ + Hub.prototype.uniqueId = ""; + + /** + * Hub state. + * @member {google.cloud.networkconnectivity.v1.State} state + * @memberof google.cloud.networkconnectivity.v1.Hub + * @instance + */ + Hub.prototype.state = 0; + + /** + * Creates a new Hub instance using the specified properties. + * @function create + * @memberof google.cloud.networkconnectivity.v1.Hub + * @static + * @param {google.cloud.networkconnectivity.v1.IHub=} [properties] Properties to set + * @returns {google.cloud.networkconnectivity.v1.Hub} Hub instance + */ + Hub.create = function create(properties) { + return new Hub(properties); + }; + + /** + * Encodes the specified Hub message. Does not implicitly {@link google.cloud.networkconnectivity.v1.Hub.verify|verify} messages. + * @function encode + * @memberof google.cloud.networkconnectivity.v1.Hub + * @static + * @param {google.cloud.networkconnectivity.v1.IHub} message Hub message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Hub.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.uniqueId != null && Object.hasOwnProperty.call(message, "uniqueId")) + writer.uint32(/* id 8, wireType 2 =*/66).string(message.uniqueId); + if (message.state != null && Object.hasOwnProperty.call(message, "state")) + writer.uint32(/* id 9, wireType 0 =*/72).int32(message.state); + return writer; + }; + + /** + * Encodes the specified Hub message, length delimited. Does not implicitly {@link google.cloud.networkconnectivity.v1.Hub.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.networkconnectivity.v1.Hub + * @static + * @param {google.cloud.networkconnectivity.v1.IHub} message Hub message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Hub.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Hub message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.networkconnectivity.v1.Hub + * @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.Hub} Hub + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Hub.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.Hub(), key, value; + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + case 2: + message.createTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + case 3: + message.updateTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + 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; + break; + case 5: + message.description = reader.string(); + break; + case 8: + message.uniqueId = reader.string(); + break; + case 9: + message.state = reader.int32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Hub message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.networkconnectivity.v1.Hub + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.networkconnectivity.v1.Hub} Hub + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Hub.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Hub message. + * @function verify + * @memberof google.cloud.networkconnectivity.v1.Hub + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Hub.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.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.uniqueId != null && message.hasOwnProperty("uniqueId")) + if (!$util.isString(message.uniqueId)) + return "uniqueId: string expected"; + if (message.state != null && message.hasOwnProperty("state")) + switch (message.state) { + default: + return "state: enum value expected"; + case 0: + case 1: + case 2: + case 3: + break; + } + return null; + }; + + /** + * Creates a Hub message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.networkconnectivity.v1.Hub + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.networkconnectivity.v1.Hub} Hub + */ + Hub.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.networkconnectivity.v1.Hub) + return object; + var message = new $root.google.cloud.networkconnectivity.v1.Hub(); + if (object.name != null) + message.name = String(object.name); + if (object.createTime != null) { + if (typeof object.createTime !== "object") + throw TypeError(".google.cloud.networkconnectivity.v1.Hub.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.Hub.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.Hub.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.uniqueId != null) + message.uniqueId = String(object.uniqueId); + switch (object.state) { + case "STATE_UNSPECIFIED": + case 0: + message.state = 0; + break; + case "CREATING": + case 1: + message.state = 1; + break; + case "ACTIVE": + case 2: + message.state = 2; + break; + case "DELETING": + case 3: + message.state = 3; + break; + } + return message; + }; + + /** + * Creates a plain object from a Hub message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.networkconnectivity.v1.Hub + * @static + * @param {google.cloud.networkconnectivity.v1.Hub} message Hub + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Hub.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.objects || options.defaults) + object.labels = {}; + if (options.defaults) { + object.name = ""; + object.createTime = null; + object.updateTime = null; + object.description = ""; + object.uniqueId = ""; + object.state = options.enums === String ? "STATE_UNSPECIFIED" : 0; + } + 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.uniqueId != null && message.hasOwnProperty("uniqueId")) + object.uniqueId = message.uniqueId; + if (message.state != null && message.hasOwnProperty("state")) + object.state = options.enums === String ? $root.google.cloud.networkconnectivity.v1.State[message.state] : message.state; + return object; + }; + + /** + * Converts this Hub to JSON. + * @function toJSON + * @memberof google.cloud.networkconnectivity.v1.Hub + * @instance + * @returns {Object.} JSON object + */ + Hub.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Hub; + })(); + + /** + * State enum. + * @name google.cloud.networkconnectivity.v1.State + * @enum {number} + * @property {number} STATE_UNSPECIFIED=0 STATE_UNSPECIFIED value + * @property {number} CREATING=1 CREATING value + * @property {number} ACTIVE=2 ACTIVE value + * @property {number} DELETING=3 DELETING value + */ + v1.State = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "STATE_UNSPECIFIED"] = 0; + values[valuesById[1] = "CREATING"] = 1; + values[valuesById[2] = "ACTIVE"] = 2; + values[valuesById[3] = "DELETING"] = 3; + return values; + })(); + + v1.Spoke = (function() { + + /** + * Properties of a Spoke. + * @memberof google.cloud.networkconnectivity.v1 + * @interface ISpoke + * @property {string|null} [name] Spoke name + * @property {google.protobuf.ITimestamp|null} [createTime] Spoke createTime + * @property {google.protobuf.ITimestamp|null} [updateTime] Spoke updateTime + * @property {Object.|null} [labels] Spoke labels + * @property {string|null} [description] Spoke description + * @property {string|null} [hub] Spoke hub + * @property {google.cloud.networkconnectivity.v1.ILinkedVpnTunnels|null} [linkedVpnTunnels] Spoke linkedVpnTunnels + * @property {google.cloud.networkconnectivity.v1.ILinkedInterconnectAttachments|null} [linkedInterconnectAttachments] Spoke linkedInterconnectAttachments + * @property {google.cloud.networkconnectivity.v1.ILinkedRouterApplianceInstances|null} [linkedRouterApplianceInstances] Spoke linkedRouterApplianceInstances + * @property {string|null} [uniqueId] Spoke uniqueId + * @property {google.cloud.networkconnectivity.v1.State|null} [state] Spoke state + */ + + /** + * Constructs a new Spoke. + * @memberof google.cloud.networkconnectivity.v1 + * @classdesc Represents a Spoke. + * @implements ISpoke + * @constructor + * @param {google.cloud.networkconnectivity.v1.ISpoke=} [properties] Properties to set + */ + function Spoke(properties) { + this.labels = {}; + 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]]; + } + + /** + * Spoke name. + * @member {string} name + * @memberof google.cloud.networkconnectivity.v1.Spoke + * @instance + */ + Spoke.prototype.name = ""; + + /** + * Spoke createTime. + * @member {google.protobuf.ITimestamp|null|undefined} createTime + * @memberof google.cloud.networkconnectivity.v1.Spoke + * @instance + */ + Spoke.prototype.createTime = null; + + /** + * Spoke updateTime. + * @member {google.protobuf.ITimestamp|null|undefined} updateTime + * @memberof google.cloud.networkconnectivity.v1.Spoke + * @instance + */ + Spoke.prototype.updateTime = null; + + /** + * Spoke labels. + * @member {Object.} labels + * @memberof google.cloud.networkconnectivity.v1.Spoke + * @instance + */ + Spoke.prototype.labels = $util.emptyObject; + + /** + * Spoke description. + * @member {string} description + * @memberof google.cloud.networkconnectivity.v1.Spoke + * @instance + */ + Spoke.prototype.description = ""; + + /** + * Spoke hub. + * @member {string} hub + * @memberof google.cloud.networkconnectivity.v1.Spoke + * @instance + */ + Spoke.prototype.hub = ""; + + /** + * Spoke linkedVpnTunnels. + * @member {google.cloud.networkconnectivity.v1.ILinkedVpnTunnels|null|undefined} linkedVpnTunnels + * @memberof google.cloud.networkconnectivity.v1.Spoke + * @instance + */ + Spoke.prototype.linkedVpnTunnels = null; + + /** + * Spoke linkedInterconnectAttachments. + * @member {google.cloud.networkconnectivity.v1.ILinkedInterconnectAttachments|null|undefined} linkedInterconnectAttachments + * @memberof google.cloud.networkconnectivity.v1.Spoke + * @instance + */ + Spoke.prototype.linkedInterconnectAttachments = null; + + /** + * Spoke linkedRouterApplianceInstances. + * @member {google.cloud.networkconnectivity.v1.ILinkedRouterApplianceInstances|null|undefined} linkedRouterApplianceInstances + * @memberof google.cloud.networkconnectivity.v1.Spoke + * @instance + */ + Spoke.prototype.linkedRouterApplianceInstances = null; + + /** + * Spoke uniqueId. + * @member {string} uniqueId + * @memberof google.cloud.networkconnectivity.v1.Spoke + * @instance + */ + Spoke.prototype.uniqueId = ""; + + /** + * Spoke state. + * @member {google.cloud.networkconnectivity.v1.State} state + * @memberof google.cloud.networkconnectivity.v1.Spoke + * @instance + */ + Spoke.prototype.state = 0; + + /** + * Creates a new Spoke instance using the specified properties. + * @function create + * @memberof google.cloud.networkconnectivity.v1.Spoke + * @static + * @param {google.cloud.networkconnectivity.v1.ISpoke=} [properties] Properties to set + * @returns {google.cloud.networkconnectivity.v1.Spoke} Spoke instance + */ + Spoke.create = function create(properties) { + return new Spoke(properties); + }; + + /** + * Encodes the specified Spoke message. Does not implicitly {@link google.cloud.networkconnectivity.v1.Spoke.verify|verify} messages. + * @function encode + * @memberof google.cloud.networkconnectivity.v1.Spoke + * @static + * @param {google.cloud.networkconnectivity.v1.ISpoke} message Spoke message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Spoke.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.hub != null && Object.hasOwnProperty.call(message, "hub")) + writer.uint32(/* id 6, wireType 2 =*/50).string(message.hub); + if (message.uniqueId != null && Object.hasOwnProperty.call(message, "uniqueId")) + writer.uint32(/* id 11, wireType 2 =*/90).string(message.uniqueId); + if (message.state != null && Object.hasOwnProperty.call(message, "state")) + writer.uint32(/* id 15, wireType 0 =*/120).int32(message.state); + if (message.linkedVpnTunnels != null && Object.hasOwnProperty.call(message, "linkedVpnTunnels")) + $root.google.cloud.networkconnectivity.v1.LinkedVpnTunnels.encode(message.linkedVpnTunnels, writer.uint32(/* id 17, wireType 2 =*/138).fork()).ldelim(); + if (message.linkedInterconnectAttachments != null && Object.hasOwnProperty.call(message, "linkedInterconnectAttachments")) + $root.google.cloud.networkconnectivity.v1.LinkedInterconnectAttachments.encode(message.linkedInterconnectAttachments, writer.uint32(/* id 18, wireType 2 =*/146).fork()).ldelim(); + if (message.linkedRouterApplianceInstances != null && Object.hasOwnProperty.call(message, "linkedRouterApplianceInstances")) + $root.google.cloud.networkconnectivity.v1.LinkedRouterApplianceInstances.encode(message.linkedRouterApplianceInstances, writer.uint32(/* id 19, wireType 2 =*/154).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified Spoke message, length delimited. Does not implicitly {@link google.cloud.networkconnectivity.v1.Spoke.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.networkconnectivity.v1.Spoke + * @static + * @param {google.cloud.networkconnectivity.v1.ISpoke} message Spoke message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Spoke.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Spoke message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.networkconnectivity.v1.Spoke + * @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.Spoke} Spoke + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Spoke.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.Spoke(), key, value; + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + case 2: + message.createTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + case 3: + message.updateTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + 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; + break; + case 5: + message.description = reader.string(); + break; + case 6: + message.hub = reader.string(); + break; + case 17: + message.linkedVpnTunnels = $root.google.cloud.networkconnectivity.v1.LinkedVpnTunnels.decode(reader, reader.uint32()); + break; + case 18: + message.linkedInterconnectAttachments = $root.google.cloud.networkconnectivity.v1.LinkedInterconnectAttachments.decode(reader, reader.uint32()); + break; + case 19: + message.linkedRouterApplianceInstances = $root.google.cloud.networkconnectivity.v1.LinkedRouterApplianceInstances.decode(reader, reader.uint32()); + break; + case 11: + message.uniqueId = reader.string(); + break; + case 15: + message.state = reader.int32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Spoke message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.networkconnectivity.v1.Spoke + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.networkconnectivity.v1.Spoke} Spoke + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Spoke.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Spoke message. + * @function verify + * @memberof google.cloud.networkconnectivity.v1.Spoke + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Spoke.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.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.hub != null && message.hasOwnProperty("hub")) + if (!$util.isString(message.hub)) + return "hub: string expected"; + if (message.linkedVpnTunnels != null && message.hasOwnProperty("linkedVpnTunnels")) { + var error = $root.google.cloud.networkconnectivity.v1.LinkedVpnTunnels.verify(message.linkedVpnTunnels); + if (error) + return "linkedVpnTunnels." + error; + } + if (message.linkedInterconnectAttachments != null && message.hasOwnProperty("linkedInterconnectAttachments")) { + var error = $root.google.cloud.networkconnectivity.v1.LinkedInterconnectAttachments.verify(message.linkedInterconnectAttachments); + if (error) + return "linkedInterconnectAttachments." + error; + } + if (message.linkedRouterApplianceInstances != null && message.hasOwnProperty("linkedRouterApplianceInstances")) { + var error = $root.google.cloud.networkconnectivity.v1.LinkedRouterApplianceInstances.verify(message.linkedRouterApplianceInstances); + if (error) + return "linkedRouterApplianceInstances." + error; + } + if (message.uniqueId != null && message.hasOwnProperty("uniqueId")) + if (!$util.isString(message.uniqueId)) + return "uniqueId: string expected"; + if (message.state != null && message.hasOwnProperty("state")) + switch (message.state) { + default: + return "state: enum value expected"; + case 0: + case 1: + case 2: + case 3: + break; + } + return null; + }; + + /** + * Creates a Spoke message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.networkconnectivity.v1.Spoke + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.networkconnectivity.v1.Spoke} Spoke + */ + Spoke.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.networkconnectivity.v1.Spoke) + return object; + var message = new $root.google.cloud.networkconnectivity.v1.Spoke(); + if (object.name != null) + message.name = String(object.name); + if (object.createTime != null) { + if (typeof object.createTime !== "object") + throw TypeError(".google.cloud.networkconnectivity.v1.Spoke.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.Spoke.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.Spoke.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.hub != null) + message.hub = String(object.hub); + if (object.linkedVpnTunnels != null) { + if (typeof object.linkedVpnTunnels !== "object") + throw TypeError(".google.cloud.networkconnectivity.v1.Spoke.linkedVpnTunnels: object expected"); + message.linkedVpnTunnels = $root.google.cloud.networkconnectivity.v1.LinkedVpnTunnels.fromObject(object.linkedVpnTunnels); + } + if (object.linkedInterconnectAttachments != null) { + if (typeof object.linkedInterconnectAttachments !== "object") + throw TypeError(".google.cloud.networkconnectivity.v1.Spoke.linkedInterconnectAttachments: object expected"); + message.linkedInterconnectAttachments = $root.google.cloud.networkconnectivity.v1.LinkedInterconnectAttachments.fromObject(object.linkedInterconnectAttachments); + } + if (object.linkedRouterApplianceInstances != null) { + if (typeof object.linkedRouterApplianceInstances !== "object") + throw TypeError(".google.cloud.networkconnectivity.v1.Spoke.linkedRouterApplianceInstances: object expected"); + message.linkedRouterApplianceInstances = $root.google.cloud.networkconnectivity.v1.LinkedRouterApplianceInstances.fromObject(object.linkedRouterApplianceInstances); + } + if (object.uniqueId != null) + message.uniqueId = String(object.uniqueId); + switch (object.state) { + case "STATE_UNSPECIFIED": + case 0: + message.state = 0; + break; + case "CREATING": + case 1: + message.state = 1; + break; + case "ACTIVE": + case 2: + message.state = 2; + break; + case "DELETING": + case 3: + message.state = 3; + break; + } + return message; + }; + + /** + * Creates a plain object from a Spoke message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.networkconnectivity.v1.Spoke + * @static + * @param {google.cloud.networkconnectivity.v1.Spoke} message Spoke + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Spoke.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.objects || options.defaults) + object.labels = {}; + if (options.defaults) { + object.name = ""; + object.createTime = null; + object.updateTime = null; + object.description = ""; + object.hub = ""; + object.uniqueId = ""; + object.state = options.enums === String ? "STATE_UNSPECIFIED" : 0; + object.linkedVpnTunnels = null; + object.linkedInterconnectAttachments = null; + object.linkedRouterApplianceInstances = null; + } + 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.hub != null && message.hasOwnProperty("hub")) + object.hub = message.hub; + if (message.uniqueId != null && message.hasOwnProperty("uniqueId")) + object.uniqueId = message.uniqueId; + if (message.state != null && message.hasOwnProperty("state")) + object.state = options.enums === String ? $root.google.cloud.networkconnectivity.v1.State[message.state] : message.state; + if (message.linkedVpnTunnels != null && message.hasOwnProperty("linkedVpnTunnels")) + object.linkedVpnTunnels = $root.google.cloud.networkconnectivity.v1.LinkedVpnTunnels.toObject(message.linkedVpnTunnels, options); + if (message.linkedInterconnectAttachments != null && message.hasOwnProperty("linkedInterconnectAttachments")) + object.linkedInterconnectAttachments = $root.google.cloud.networkconnectivity.v1.LinkedInterconnectAttachments.toObject(message.linkedInterconnectAttachments, options); + if (message.linkedRouterApplianceInstances != null && message.hasOwnProperty("linkedRouterApplianceInstances")) + object.linkedRouterApplianceInstances = $root.google.cloud.networkconnectivity.v1.LinkedRouterApplianceInstances.toObject(message.linkedRouterApplianceInstances, options); + return object; + }; + + /** + * Converts this Spoke to JSON. + * @function toJSON + * @memberof google.cloud.networkconnectivity.v1.Spoke + * @instance + * @returns {Object.} JSON object + */ + Spoke.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Spoke; + })(); + + v1.ListHubsRequest = (function() { + + /** + * Properties of a ListHubsRequest. + * @memberof google.cloud.networkconnectivity.v1 + * @interface IListHubsRequest + * @property {string|null} [parent] ListHubsRequest parent + * @property {number|null} [pageSize] ListHubsRequest pageSize + * @property {string|null} [pageToken] ListHubsRequest pageToken + * @property {string|null} [filter] ListHubsRequest filter + * @property {string|null} [orderBy] ListHubsRequest orderBy + */ + + /** + * Constructs a new ListHubsRequest. + * @memberof google.cloud.networkconnectivity.v1 + * @classdesc Represents a ListHubsRequest. + * @implements IListHubsRequest + * @constructor + * @param {google.cloud.networkconnectivity.v1.IListHubsRequest=} [properties] Properties to set + */ + function ListHubsRequest(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]]; + } + + /** + * ListHubsRequest parent. + * @member {string} parent + * @memberof google.cloud.networkconnectivity.v1.ListHubsRequest + * @instance + */ + ListHubsRequest.prototype.parent = ""; + + /** + * ListHubsRequest pageSize. + * @member {number} pageSize + * @memberof google.cloud.networkconnectivity.v1.ListHubsRequest + * @instance + */ + ListHubsRequest.prototype.pageSize = 0; + + /** + * ListHubsRequest pageToken. + * @member {string} pageToken + * @memberof google.cloud.networkconnectivity.v1.ListHubsRequest + * @instance + */ + ListHubsRequest.prototype.pageToken = ""; + + /** + * ListHubsRequest filter. + * @member {string} filter + * @memberof google.cloud.networkconnectivity.v1.ListHubsRequest + * @instance + */ + ListHubsRequest.prototype.filter = ""; + + /** + * ListHubsRequest orderBy. + * @member {string} orderBy + * @memberof google.cloud.networkconnectivity.v1.ListHubsRequest + * @instance + */ + ListHubsRequest.prototype.orderBy = ""; + + /** + * Creates a new ListHubsRequest instance using the specified properties. + * @function create + * @memberof google.cloud.networkconnectivity.v1.ListHubsRequest + * @static + * @param {google.cloud.networkconnectivity.v1.IListHubsRequest=} [properties] Properties to set + * @returns {google.cloud.networkconnectivity.v1.ListHubsRequest} ListHubsRequest instance + */ + ListHubsRequest.create = function create(properties) { + return new ListHubsRequest(properties); + }; + + /** + * Encodes the specified ListHubsRequest message. Does not implicitly {@link google.cloud.networkconnectivity.v1.ListHubsRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.networkconnectivity.v1.ListHubsRequest + * @static + * @param {google.cloud.networkconnectivity.v1.IListHubsRequest} message ListHubsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListHubsRequest.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 ListHubsRequest message, length delimited. Does not implicitly {@link google.cloud.networkconnectivity.v1.ListHubsRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.networkconnectivity.v1.ListHubsRequest + * @static + * @param {google.cloud.networkconnectivity.v1.IListHubsRequest} message ListHubsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListHubsRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListHubsRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.networkconnectivity.v1.ListHubsRequest + * @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.ListHubsRequest} ListHubsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListHubsRequest.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.ListHubsRequest(); + 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 ListHubsRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.networkconnectivity.v1.ListHubsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.networkconnectivity.v1.ListHubsRequest} ListHubsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListHubsRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListHubsRequest message. + * @function verify + * @memberof google.cloud.networkconnectivity.v1.ListHubsRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListHubsRequest.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 ListHubsRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.networkconnectivity.v1.ListHubsRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.networkconnectivity.v1.ListHubsRequest} ListHubsRequest + */ + ListHubsRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.networkconnectivity.v1.ListHubsRequest) + return object; + var message = new $root.google.cloud.networkconnectivity.v1.ListHubsRequest(); + 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 ListHubsRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.networkconnectivity.v1.ListHubsRequest + * @static + * @param {google.cloud.networkconnectivity.v1.ListHubsRequest} message ListHubsRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListHubsRequest.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 ListHubsRequest to JSON. + * @function toJSON + * @memberof google.cloud.networkconnectivity.v1.ListHubsRequest + * @instance + * @returns {Object.} JSON object + */ + ListHubsRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ListHubsRequest; + })(); + + v1.ListHubsResponse = (function() { + + /** + * Properties of a ListHubsResponse. + * @memberof google.cloud.networkconnectivity.v1 + * @interface IListHubsResponse + * @property {Array.|null} [hubs] ListHubsResponse hubs + * @property {string|null} [nextPageToken] ListHubsResponse nextPageToken + * @property {Array.|null} [unreachable] ListHubsResponse unreachable + */ + + /** + * Constructs a new ListHubsResponse. + * @memberof google.cloud.networkconnectivity.v1 + * @classdesc Represents a ListHubsResponse. + * @implements IListHubsResponse + * @constructor + * @param {google.cloud.networkconnectivity.v1.IListHubsResponse=} [properties] Properties to set + */ + function ListHubsResponse(properties) { + this.hubs = []; + 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]]; + } + + /** + * ListHubsResponse hubs. + * @member {Array.} hubs + * @memberof google.cloud.networkconnectivity.v1.ListHubsResponse + * @instance + */ + ListHubsResponse.prototype.hubs = $util.emptyArray; + + /** + * ListHubsResponse nextPageToken. + * @member {string} nextPageToken + * @memberof google.cloud.networkconnectivity.v1.ListHubsResponse + * @instance + */ + ListHubsResponse.prototype.nextPageToken = ""; + + /** + * ListHubsResponse unreachable. + * @member {Array.} unreachable + * @memberof google.cloud.networkconnectivity.v1.ListHubsResponse + * @instance + */ + ListHubsResponse.prototype.unreachable = $util.emptyArray; + + /** + * Creates a new ListHubsResponse instance using the specified properties. + * @function create + * @memberof google.cloud.networkconnectivity.v1.ListHubsResponse + * @static + * @param {google.cloud.networkconnectivity.v1.IListHubsResponse=} [properties] Properties to set + * @returns {google.cloud.networkconnectivity.v1.ListHubsResponse} ListHubsResponse instance + */ + ListHubsResponse.create = function create(properties) { + return new ListHubsResponse(properties); + }; + + /** + * Encodes the specified ListHubsResponse message. Does not implicitly {@link google.cloud.networkconnectivity.v1.ListHubsResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.networkconnectivity.v1.ListHubsResponse + * @static + * @param {google.cloud.networkconnectivity.v1.IListHubsResponse} message ListHubsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListHubsResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.hubs != null && message.hubs.length) + for (var i = 0; i < message.hubs.length; ++i) + $root.google.cloud.networkconnectivity.v1.Hub.encode(message.hubs[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 ListHubsResponse message, length delimited. Does not implicitly {@link google.cloud.networkconnectivity.v1.ListHubsResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.networkconnectivity.v1.ListHubsResponse + * @static + * @param {google.cloud.networkconnectivity.v1.IListHubsResponse} message ListHubsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListHubsResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListHubsResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.networkconnectivity.v1.ListHubsResponse + * @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.ListHubsResponse} ListHubsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListHubsResponse.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.ListHubsResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.hubs && message.hubs.length)) + message.hubs = []; + message.hubs.push($root.google.cloud.networkconnectivity.v1.Hub.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 ListHubsResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.networkconnectivity.v1.ListHubsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.networkconnectivity.v1.ListHubsResponse} ListHubsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListHubsResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListHubsResponse message. + * @function verify + * @memberof google.cloud.networkconnectivity.v1.ListHubsResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListHubsResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.hubs != null && message.hasOwnProperty("hubs")) { + if (!Array.isArray(message.hubs)) + return "hubs: array expected"; + for (var i = 0; i < message.hubs.length; ++i) { + var error = $root.google.cloud.networkconnectivity.v1.Hub.verify(message.hubs[i]); + if (error) + return "hubs." + 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 ListHubsResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.networkconnectivity.v1.ListHubsResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.networkconnectivity.v1.ListHubsResponse} ListHubsResponse + */ + ListHubsResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.networkconnectivity.v1.ListHubsResponse) + return object; + var message = new $root.google.cloud.networkconnectivity.v1.ListHubsResponse(); + if (object.hubs) { + if (!Array.isArray(object.hubs)) + throw TypeError(".google.cloud.networkconnectivity.v1.ListHubsResponse.hubs: array expected"); + message.hubs = []; + for (var i = 0; i < object.hubs.length; ++i) { + if (typeof object.hubs[i] !== "object") + throw TypeError(".google.cloud.networkconnectivity.v1.ListHubsResponse.hubs: object expected"); + message.hubs[i] = $root.google.cloud.networkconnectivity.v1.Hub.fromObject(object.hubs[i]); + } + } + if (object.nextPageToken != null) + message.nextPageToken = String(object.nextPageToken); + if (object.unreachable) { + if (!Array.isArray(object.unreachable)) + throw TypeError(".google.cloud.networkconnectivity.v1.ListHubsResponse.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 ListHubsResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.networkconnectivity.v1.ListHubsResponse + * @static + * @param {google.cloud.networkconnectivity.v1.ListHubsResponse} message ListHubsResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListHubsResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.hubs = []; + object.unreachable = []; + } + if (options.defaults) + object.nextPageToken = ""; + if (message.hubs && message.hubs.length) { + object.hubs = []; + for (var j = 0; j < message.hubs.length; ++j) + object.hubs[j] = $root.google.cloud.networkconnectivity.v1.Hub.toObject(message.hubs[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 ListHubsResponse to JSON. + * @function toJSON + * @memberof google.cloud.networkconnectivity.v1.ListHubsResponse + * @instance + * @returns {Object.} JSON object + */ + ListHubsResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ListHubsResponse; + })(); + + v1.GetHubRequest = (function() { + + /** + * Properties of a GetHubRequest. + * @memberof google.cloud.networkconnectivity.v1 + * @interface IGetHubRequest + * @property {string|null} [name] GetHubRequest name + */ + + /** + * Constructs a new GetHubRequest. + * @memberof google.cloud.networkconnectivity.v1 + * @classdesc Represents a GetHubRequest. + * @implements IGetHubRequest + * @constructor + * @param {google.cloud.networkconnectivity.v1.IGetHubRequest=} [properties] Properties to set + */ + function GetHubRequest(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]]; + } + + /** + * GetHubRequest name. + * @member {string} name + * @memberof google.cloud.networkconnectivity.v1.GetHubRequest + * @instance + */ + GetHubRequest.prototype.name = ""; + + /** + * Creates a new GetHubRequest instance using the specified properties. + * @function create + * @memberof google.cloud.networkconnectivity.v1.GetHubRequest + * @static + * @param {google.cloud.networkconnectivity.v1.IGetHubRequest=} [properties] Properties to set + * @returns {google.cloud.networkconnectivity.v1.GetHubRequest} GetHubRequest instance + */ + GetHubRequest.create = function create(properties) { + return new GetHubRequest(properties); + }; + + /** + * Encodes the specified GetHubRequest message. Does not implicitly {@link google.cloud.networkconnectivity.v1.GetHubRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.networkconnectivity.v1.GetHubRequest + * @static + * @param {google.cloud.networkconnectivity.v1.IGetHubRequest} message GetHubRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetHubRequest.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 GetHubRequest message, length delimited. Does not implicitly {@link google.cloud.networkconnectivity.v1.GetHubRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.networkconnectivity.v1.GetHubRequest + * @static + * @param {google.cloud.networkconnectivity.v1.IGetHubRequest} message GetHubRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetHubRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GetHubRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.networkconnectivity.v1.GetHubRequest + * @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.GetHubRequest} GetHubRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetHubRequest.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.GetHubRequest(); + 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 GetHubRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.networkconnectivity.v1.GetHubRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.networkconnectivity.v1.GetHubRequest} GetHubRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetHubRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GetHubRequest message. + * @function verify + * @memberof google.cloud.networkconnectivity.v1.GetHubRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GetHubRequest.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 GetHubRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.networkconnectivity.v1.GetHubRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.networkconnectivity.v1.GetHubRequest} GetHubRequest + */ + GetHubRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.networkconnectivity.v1.GetHubRequest) + return object; + var message = new $root.google.cloud.networkconnectivity.v1.GetHubRequest(); + if (object.name != null) + message.name = String(object.name); + return message; + }; + + /** + * Creates a plain object from a GetHubRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.networkconnectivity.v1.GetHubRequest + * @static + * @param {google.cloud.networkconnectivity.v1.GetHubRequest} message GetHubRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GetHubRequest.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 GetHubRequest to JSON. + * @function toJSON + * @memberof google.cloud.networkconnectivity.v1.GetHubRequest + * @instance + * @returns {Object.} JSON object + */ + GetHubRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return GetHubRequest; + })(); + + v1.CreateHubRequest = (function() { + + /** + * Properties of a CreateHubRequest. + * @memberof google.cloud.networkconnectivity.v1 + * @interface ICreateHubRequest + * @property {string|null} [parent] CreateHubRequest parent + * @property {string|null} [hubId] CreateHubRequest hubId + * @property {google.cloud.networkconnectivity.v1.IHub|null} [hub] CreateHubRequest hub + * @property {string|null} [requestId] CreateHubRequest requestId + */ + + /** + * Constructs a new CreateHubRequest. + * @memberof google.cloud.networkconnectivity.v1 + * @classdesc Represents a CreateHubRequest. + * @implements ICreateHubRequest + * @constructor + * @param {google.cloud.networkconnectivity.v1.ICreateHubRequest=} [properties] Properties to set + */ + function CreateHubRequest(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]]; + } + + /** + * CreateHubRequest parent. + * @member {string} parent + * @memberof google.cloud.networkconnectivity.v1.CreateHubRequest + * @instance + */ + CreateHubRequest.prototype.parent = ""; + + /** + * CreateHubRequest hubId. + * @member {string} hubId + * @memberof google.cloud.networkconnectivity.v1.CreateHubRequest + * @instance + */ + CreateHubRequest.prototype.hubId = ""; + + /** + * CreateHubRequest hub. + * @member {google.cloud.networkconnectivity.v1.IHub|null|undefined} hub + * @memberof google.cloud.networkconnectivity.v1.CreateHubRequest + * @instance + */ + CreateHubRequest.prototype.hub = null; + + /** + * CreateHubRequest requestId. + * @member {string} requestId + * @memberof google.cloud.networkconnectivity.v1.CreateHubRequest + * @instance + */ + CreateHubRequest.prototype.requestId = ""; + + /** + * Creates a new CreateHubRequest instance using the specified properties. + * @function create + * @memberof google.cloud.networkconnectivity.v1.CreateHubRequest + * @static + * @param {google.cloud.networkconnectivity.v1.ICreateHubRequest=} [properties] Properties to set + * @returns {google.cloud.networkconnectivity.v1.CreateHubRequest} CreateHubRequest instance + */ + CreateHubRequest.create = function create(properties) { + return new CreateHubRequest(properties); + }; + + /** + * Encodes the specified CreateHubRequest message. Does not implicitly {@link google.cloud.networkconnectivity.v1.CreateHubRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.networkconnectivity.v1.CreateHubRequest + * @static + * @param {google.cloud.networkconnectivity.v1.ICreateHubRequest} message CreateHubRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CreateHubRequest.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.hubId != null && Object.hasOwnProperty.call(message, "hubId")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.hubId); + if (message.hub != null && Object.hasOwnProperty.call(message, "hub")) + $root.google.cloud.networkconnectivity.v1.Hub.encode(message.hub, 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 CreateHubRequest message, length delimited. Does not implicitly {@link google.cloud.networkconnectivity.v1.CreateHubRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.networkconnectivity.v1.CreateHubRequest + * @static + * @param {google.cloud.networkconnectivity.v1.ICreateHubRequest} message CreateHubRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CreateHubRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a CreateHubRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.networkconnectivity.v1.CreateHubRequest + * @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.CreateHubRequest} CreateHubRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CreateHubRequest.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.CreateHubRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.parent = reader.string(); + break; + case 2: + message.hubId = reader.string(); + break; + case 3: + message.hub = $root.google.cloud.networkconnectivity.v1.Hub.decode(reader, reader.uint32()); + break; + case 4: + message.requestId = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a CreateHubRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.networkconnectivity.v1.CreateHubRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.networkconnectivity.v1.CreateHubRequest} CreateHubRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CreateHubRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a CreateHubRequest message. + * @function verify + * @memberof google.cloud.networkconnectivity.v1.CreateHubRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + CreateHubRequest.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.hubId != null && message.hasOwnProperty("hubId")) + if (!$util.isString(message.hubId)) + return "hubId: string expected"; + if (message.hub != null && message.hasOwnProperty("hub")) { + var error = $root.google.cloud.networkconnectivity.v1.Hub.verify(message.hub); + if (error) + return "hub." + error; + } + if (message.requestId != null && message.hasOwnProperty("requestId")) + if (!$util.isString(message.requestId)) + return "requestId: string expected"; + return null; + }; + + /** + * Creates a CreateHubRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.networkconnectivity.v1.CreateHubRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.networkconnectivity.v1.CreateHubRequest} CreateHubRequest + */ + CreateHubRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.networkconnectivity.v1.CreateHubRequest) + return object; + var message = new $root.google.cloud.networkconnectivity.v1.CreateHubRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.hubId != null) + message.hubId = String(object.hubId); + if (object.hub != null) { + if (typeof object.hub !== "object") + throw TypeError(".google.cloud.networkconnectivity.v1.CreateHubRequest.hub: object expected"); + message.hub = $root.google.cloud.networkconnectivity.v1.Hub.fromObject(object.hub); + } + if (object.requestId != null) + message.requestId = String(object.requestId); + return message; + }; + + /** + * Creates a plain object from a CreateHubRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.networkconnectivity.v1.CreateHubRequest + * @static + * @param {google.cloud.networkconnectivity.v1.CreateHubRequest} message CreateHubRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + CreateHubRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object.hubId = ""; + object.hub = null; + object.requestId = ""; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.hubId != null && message.hasOwnProperty("hubId")) + object.hubId = message.hubId; + if (message.hub != null && message.hasOwnProperty("hub")) + object.hub = $root.google.cloud.networkconnectivity.v1.Hub.toObject(message.hub, options); + if (message.requestId != null && message.hasOwnProperty("requestId")) + object.requestId = message.requestId; + return object; + }; + + /** + * Converts this CreateHubRequest to JSON. + * @function toJSON + * @memberof google.cloud.networkconnectivity.v1.CreateHubRequest + * @instance + * @returns {Object.} JSON object + */ + CreateHubRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return CreateHubRequest; + })(); + + v1.UpdateHubRequest = (function() { + + /** + * Properties of an UpdateHubRequest. + * @memberof google.cloud.networkconnectivity.v1 + * @interface IUpdateHubRequest + * @property {google.protobuf.IFieldMask|null} [updateMask] UpdateHubRequest updateMask + * @property {google.cloud.networkconnectivity.v1.IHub|null} [hub] UpdateHubRequest hub + * @property {string|null} [requestId] UpdateHubRequest requestId + */ + + /** + * Constructs a new UpdateHubRequest. + * @memberof google.cloud.networkconnectivity.v1 + * @classdesc Represents an UpdateHubRequest. + * @implements IUpdateHubRequest + * @constructor + * @param {google.cloud.networkconnectivity.v1.IUpdateHubRequest=} [properties] Properties to set + */ + function UpdateHubRequest(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]]; + } + + /** + * UpdateHubRequest updateMask. + * @member {google.protobuf.IFieldMask|null|undefined} updateMask + * @memberof google.cloud.networkconnectivity.v1.UpdateHubRequest + * @instance + */ + UpdateHubRequest.prototype.updateMask = null; + + /** + * UpdateHubRequest hub. + * @member {google.cloud.networkconnectivity.v1.IHub|null|undefined} hub + * @memberof google.cloud.networkconnectivity.v1.UpdateHubRequest + * @instance + */ + UpdateHubRequest.prototype.hub = null; + + /** + * UpdateHubRequest requestId. + * @member {string} requestId + * @memberof google.cloud.networkconnectivity.v1.UpdateHubRequest + * @instance + */ + UpdateHubRequest.prototype.requestId = ""; + + /** + * Creates a new UpdateHubRequest instance using the specified properties. + * @function create + * @memberof google.cloud.networkconnectivity.v1.UpdateHubRequest + * @static + * @param {google.cloud.networkconnectivity.v1.IUpdateHubRequest=} [properties] Properties to set + * @returns {google.cloud.networkconnectivity.v1.UpdateHubRequest} UpdateHubRequest instance + */ + UpdateHubRequest.create = function create(properties) { + return new UpdateHubRequest(properties); + }; + + /** + * Encodes the specified UpdateHubRequest message. Does not implicitly {@link google.cloud.networkconnectivity.v1.UpdateHubRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.networkconnectivity.v1.UpdateHubRequest + * @static + * @param {google.cloud.networkconnectivity.v1.IUpdateHubRequest} message UpdateHubRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UpdateHubRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.updateMask != null && Object.hasOwnProperty.call(message, "updateMask")) + $root.google.protobuf.FieldMask.encode(message.updateMask, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.hub != null && Object.hasOwnProperty.call(message, "hub")) + $root.google.cloud.networkconnectivity.v1.Hub.encode(message.hub, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.requestId != null && Object.hasOwnProperty.call(message, "requestId")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.requestId); + return writer; + }; + + /** + * Encodes the specified UpdateHubRequest message, length delimited. Does not implicitly {@link google.cloud.networkconnectivity.v1.UpdateHubRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.networkconnectivity.v1.UpdateHubRequest + * @static + * @param {google.cloud.networkconnectivity.v1.IUpdateHubRequest} message UpdateHubRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UpdateHubRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an UpdateHubRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.networkconnectivity.v1.UpdateHubRequest + * @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.UpdateHubRequest} UpdateHubRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UpdateHubRequest.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.UpdateHubRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.updateMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); + break; + case 2: + message.hub = $root.google.cloud.networkconnectivity.v1.Hub.decode(reader, reader.uint32()); + break; + case 3: + message.requestId = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an UpdateHubRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.networkconnectivity.v1.UpdateHubRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.networkconnectivity.v1.UpdateHubRequest} UpdateHubRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UpdateHubRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an UpdateHubRequest message. + * @function verify + * @memberof google.cloud.networkconnectivity.v1.UpdateHubRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + UpdateHubRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.updateMask != null && message.hasOwnProperty("updateMask")) { + var error = $root.google.protobuf.FieldMask.verify(message.updateMask); + if (error) + return "updateMask." + error; + } + if (message.hub != null && message.hasOwnProperty("hub")) { + var error = $root.google.cloud.networkconnectivity.v1.Hub.verify(message.hub); + if (error) + return "hub." + error; + } + if (message.requestId != null && message.hasOwnProperty("requestId")) + if (!$util.isString(message.requestId)) + return "requestId: string expected"; + return null; + }; + + /** + * Creates an UpdateHubRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.networkconnectivity.v1.UpdateHubRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.networkconnectivity.v1.UpdateHubRequest} UpdateHubRequest + */ + UpdateHubRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.networkconnectivity.v1.UpdateHubRequest) + return object; + var message = new $root.google.cloud.networkconnectivity.v1.UpdateHubRequest(); + if (object.updateMask != null) { + if (typeof object.updateMask !== "object") + throw TypeError(".google.cloud.networkconnectivity.v1.UpdateHubRequest.updateMask: object expected"); + message.updateMask = $root.google.protobuf.FieldMask.fromObject(object.updateMask); + } + if (object.hub != null) { + if (typeof object.hub !== "object") + throw TypeError(".google.cloud.networkconnectivity.v1.UpdateHubRequest.hub: object expected"); + message.hub = $root.google.cloud.networkconnectivity.v1.Hub.fromObject(object.hub); + } + if (object.requestId != null) + message.requestId = String(object.requestId); + return message; + }; + + /** + * Creates a plain object from an UpdateHubRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.networkconnectivity.v1.UpdateHubRequest + * @static + * @param {google.cloud.networkconnectivity.v1.UpdateHubRequest} message UpdateHubRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + UpdateHubRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.updateMask = null; + object.hub = null; + object.requestId = ""; + } + if (message.updateMask != null && message.hasOwnProperty("updateMask")) + object.updateMask = $root.google.protobuf.FieldMask.toObject(message.updateMask, options); + if (message.hub != null && message.hasOwnProperty("hub")) + object.hub = $root.google.cloud.networkconnectivity.v1.Hub.toObject(message.hub, options); + if (message.requestId != null && message.hasOwnProperty("requestId")) + object.requestId = message.requestId; + return object; + }; + + /** + * Converts this UpdateHubRequest to JSON. + * @function toJSON + * @memberof google.cloud.networkconnectivity.v1.UpdateHubRequest + * @instance + * @returns {Object.} JSON object + */ + UpdateHubRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return UpdateHubRequest; + })(); + + v1.DeleteHubRequest = (function() { + + /** + * Properties of a DeleteHubRequest. + * @memberof google.cloud.networkconnectivity.v1 + * @interface IDeleteHubRequest + * @property {string|null} [name] DeleteHubRequest name + * @property {string|null} [requestId] DeleteHubRequest requestId + */ + + /** + * Constructs a new DeleteHubRequest. + * @memberof google.cloud.networkconnectivity.v1 + * @classdesc Represents a DeleteHubRequest. + * @implements IDeleteHubRequest + * @constructor + * @param {google.cloud.networkconnectivity.v1.IDeleteHubRequest=} [properties] Properties to set + */ + function DeleteHubRequest(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]]; + } + + /** + * DeleteHubRequest name. + * @member {string} name + * @memberof google.cloud.networkconnectivity.v1.DeleteHubRequest + * @instance + */ + DeleteHubRequest.prototype.name = ""; + + /** + * DeleteHubRequest requestId. + * @member {string} requestId + * @memberof google.cloud.networkconnectivity.v1.DeleteHubRequest + * @instance + */ + DeleteHubRequest.prototype.requestId = ""; + + /** + * Creates a new DeleteHubRequest instance using the specified properties. + * @function create + * @memberof google.cloud.networkconnectivity.v1.DeleteHubRequest + * @static + * @param {google.cloud.networkconnectivity.v1.IDeleteHubRequest=} [properties] Properties to set + * @returns {google.cloud.networkconnectivity.v1.DeleteHubRequest} DeleteHubRequest instance + */ + DeleteHubRequest.create = function create(properties) { + return new DeleteHubRequest(properties); + }; + + /** + * Encodes the specified DeleteHubRequest message. Does not implicitly {@link google.cloud.networkconnectivity.v1.DeleteHubRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.networkconnectivity.v1.DeleteHubRequest + * @static + * @param {google.cloud.networkconnectivity.v1.IDeleteHubRequest} message DeleteHubRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeleteHubRequest.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 DeleteHubRequest message, length delimited. Does not implicitly {@link google.cloud.networkconnectivity.v1.DeleteHubRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.networkconnectivity.v1.DeleteHubRequest + * @static + * @param {google.cloud.networkconnectivity.v1.IDeleteHubRequest} message DeleteHubRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeleteHubRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DeleteHubRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.networkconnectivity.v1.DeleteHubRequest + * @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.DeleteHubRequest} DeleteHubRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeleteHubRequest.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.DeleteHubRequest(); + 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 DeleteHubRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.networkconnectivity.v1.DeleteHubRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.networkconnectivity.v1.DeleteHubRequest} DeleteHubRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeleteHubRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DeleteHubRequest message. + * @function verify + * @memberof google.cloud.networkconnectivity.v1.DeleteHubRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DeleteHubRequest.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 DeleteHubRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.networkconnectivity.v1.DeleteHubRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.networkconnectivity.v1.DeleteHubRequest} DeleteHubRequest + */ + DeleteHubRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.networkconnectivity.v1.DeleteHubRequest) + return object; + var message = new $root.google.cloud.networkconnectivity.v1.DeleteHubRequest(); + 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 DeleteHubRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.networkconnectivity.v1.DeleteHubRequest + * @static + * @param {google.cloud.networkconnectivity.v1.DeleteHubRequest} message DeleteHubRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DeleteHubRequest.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 DeleteHubRequest to JSON. + * @function toJSON + * @memberof google.cloud.networkconnectivity.v1.DeleteHubRequest + * @instance + * @returns {Object.} JSON object + */ + DeleteHubRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return DeleteHubRequest; + })(); + + v1.ListSpokesRequest = (function() { + + /** + * Properties of a ListSpokesRequest. + * @memberof google.cloud.networkconnectivity.v1 + * @interface IListSpokesRequest + * @property {string|null} [parent] ListSpokesRequest parent + * @property {number|null} [pageSize] ListSpokesRequest pageSize + * @property {string|null} [pageToken] ListSpokesRequest pageToken + * @property {string|null} [filter] ListSpokesRequest filter + * @property {string|null} [orderBy] ListSpokesRequest orderBy + */ + + /** + * Constructs a new ListSpokesRequest. + * @memberof google.cloud.networkconnectivity.v1 + * @classdesc Represents a ListSpokesRequest. + * @implements IListSpokesRequest + * @constructor + * @param {google.cloud.networkconnectivity.v1.IListSpokesRequest=} [properties] Properties to set + */ + function ListSpokesRequest(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]]; + } + + /** + * ListSpokesRequest parent. + * @member {string} parent + * @memberof google.cloud.networkconnectivity.v1.ListSpokesRequest + * @instance + */ + ListSpokesRequest.prototype.parent = ""; + + /** + * ListSpokesRequest pageSize. + * @member {number} pageSize + * @memberof google.cloud.networkconnectivity.v1.ListSpokesRequest + * @instance + */ + ListSpokesRequest.prototype.pageSize = 0; + + /** + * ListSpokesRequest pageToken. + * @member {string} pageToken + * @memberof google.cloud.networkconnectivity.v1.ListSpokesRequest + * @instance + */ + ListSpokesRequest.prototype.pageToken = ""; + + /** + * ListSpokesRequest filter. + * @member {string} filter + * @memberof google.cloud.networkconnectivity.v1.ListSpokesRequest + * @instance + */ + ListSpokesRequest.prototype.filter = ""; + + /** + * ListSpokesRequest orderBy. + * @member {string} orderBy + * @memberof google.cloud.networkconnectivity.v1.ListSpokesRequest + * @instance + */ + ListSpokesRequest.prototype.orderBy = ""; + + /** + * Creates a new ListSpokesRequest instance using the specified properties. + * @function create + * @memberof google.cloud.networkconnectivity.v1.ListSpokesRequest + * @static + * @param {google.cloud.networkconnectivity.v1.IListSpokesRequest=} [properties] Properties to set + * @returns {google.cloud.networkconnectivity.v1.ListSpokesRequest} ListSpokesRequest instance + */ + ListSpokesRequest.create = function create(properties) { + return new ListSpokesRequest(properties); + }; + + /** + * Encodes the specified ListSpokesRequest message. Does not implicitly {@link google.cloud.networkconnectivity.v1.ListSpokesRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.networkconnectivity.v1.ListSpokesRequest + * @static + * @param {google.cloud.networkconnectivity.v1.IListSpokesRequest} message ListSpokesRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListSpokesRequest.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 ListSpokesRequest message, length delimited. Does not implicitly {@link google.cloud.networkconnectivity.v1.ListSpokesRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.networkconnectivity.v1.ListSpokesRequest + * @static + * @param {google.cloud.networkconnectivity.v1.IListSpokesRequest} message ListSpokesRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListSpokesRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListSpokesRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.networkconnectivity.v1.ListSpokesRequest + * @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.ListSpokesRequest} ListSpokesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListSpokesRequest.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.ListSpokesRequest(); + 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 ListSpokesRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.networkconnectivity.v1.ListSpokesRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.networkconnectivity.v1.ListSpokesRequest} ListSpokesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListSpokesRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListSpokesRequest message. + * @function verify + * @memberof google.cloud.networkconnectivity.v1.ListSpokesRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListSpokesRequest.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 ListSpokesRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.networkconnectivity.v1.ListSpokesRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.networkconnectivity.v1.ListSpokesRequest} ListSpokesRequest + */ + ListSpokesRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.networkconnectivity.v1.ListSpokesRequest) + return object; + var message = new $root.google.cloud.networkconnectivity.v1.ListSpokesRequest(); + 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 ListSpokesRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.networkconnectivity.v1.ListSpokesRequest + * @static + * @param {google.cloud.networkconnectivity.v1.ListSpokesRequest} message ListSpokesRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListSpokesRequest.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 ListSpokesRequest to JSON. + * @function toJSON + * @memberof google.cloud.networkconnectivity.v1.ListSpokesRequest + * @instance + * @returns {Object.} JSON object + */ + ListSpokesRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ListSpokesRequest; + })(); + + v1.ListSpokesResponse = (function() { + + /** + * Properties of a ListSpokesResponse. + * @memberof google.cloud.networkconnectivity.v1 + * @interface IListSpokesResponse + * @property {Array.|null} [spokes] ListSpokesResponse spokes + * @property {string|null} [nextPageToken] ListSpokesResponse nextPageToken + * @property {Array.|null} [unreachable] ListSpokesResponse unreachable + */ + + /** + * Constructs a new ListSpokesResponse. + * @memberof google.cloud.networkconnectivity.v1 + * @classdesc Represents a ListSpokesResponse. + * @implements IListSpokesResponse + * @constructor + * @param {google.cloud.networkconnectivity.v1.IListSpokesResponse=} [properties] Properties to set + */ + function ListSpokesResponse(properties) { + this.spokes = []; + 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]]; + } + + /** + * ListSpokesResponse spokes. + * @member {Array.} spokes + * @memberof google.cloud.networkconnectivity.v1.ListSpokesResponse + * @instance + */ + ListSpokesResponse.prototype.spokes = $util.emptyArray; + + /** + * ListSpokesResponse nextPageToken. + * @member {string} nextPageToken + * @memberof google.cloud.networkconnectivity.v1.ListSpokesResponse + * @instance + */ + ListSpokesResponse.prototype.nextPageToken = ""; + + /** + * ListSpokesResponse unreachable. + * @member {Array.} unreachable + * @memberof google.cloud.networkconnectivity.v1.ListSpokesResponse + * @instance + */ + ListSpokesResponse.prototype.unreachable = $util.emptyArray; + + /** + * Creates a new ListSpokesResponse instance using the specified properties. + * @function create + * @memberof google.cloud.networkconnectivity.v1.ListSpokesResponse + * @static + * @param {google.cloud.networkconnectivity.v1.IListSpokesResponse=} [properties] Properties to set + * @returns {google.cloud.networkconnectivity.v1.ListSpokesResponse} ListSpokesResponse instance + */ + ListSpokesResponse.create = function create(properties) { + return new ListSpokesResponse(properties); + }; + + /** + * Encodes the specified ListSpokesResponse message. Does not implicitly {@link google.cloud.networkconnectivity.v1.ListSpokesResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.networkconnectivity.v1.ListSpokesResponse + * @static + * @param {google.cloud.networkconnectivity.v1.IListSpokesResponse} message ListSpokesResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListSpokesResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.spokes != null && message.spokes.length) + for (var i = 0; i < message.spokes.length; ++i) + $root.google.cloud.networkconnectivity.v1.Spoke.encode(message.spokes[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 ListSpokesResponse message, length delimited. Does not implicitly {@link google.cloud.networkconnectivity.v1.ListSpokesResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.networkconnectivity.v1.ListSpokesResponse + * @static + * @param {google.cloud.networkconnectivity.v1.IListSpokesResponse} message ListSpokesResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListSpokesResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListSpokesResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.networkconnectivity.v1.ListSpokesResponse + * @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.ListSpokesResponse} ListSpokesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListSpokesResponse.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.ListSpokesResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.spokes && message.spokes.length)) + message.spokes = []; + message.spokes.push($root.google.cloud.networkconnectivity.v1.Spoke.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 ListSpokesResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.networkconnectivity.v1.ListSpokesResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.networkconnectivity.v1.ListSpokesResponse} ListSpokesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListSpokesResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListSpokesResponse message. + * @function verify + * @memberof google.cloud.networkconnectivity.v1.ListSpokesResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListSpokesResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.spokes != null && message.hasOwnProperty("spokes")) { + if (!Array.isArray(message.spokes)) + return "spokes: array expected"; + for (var i = 0; i < message.spokes.length; ++i) { + var error = $root.google.cloud.networkconnectivity.v1.Spoke.verify(message.spokes[i]); + if (error) + return "spokes." + 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 ListSpokesResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.networkconnectivity.v1.ListSpokesResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.networkconnectivity.v1.ListSpokesResponse} ListSpokesResponse + */ + ListSpokesResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.networkconnectivity.v1.ListSpokesResponse) + return object; + var message = new $root.google.cloud.networkconnectivity.v1.ListSpokesResponse(); + if (object.spokes) { + if (!Array.isArray(object.spokes)) + throw TypeError(".google.cloud.networkconnectivity.v1.ListSpokesResponse.spokes: array expected"); + message.spokes = []; + for (var i = 0; i < object.spokes.length; ++i) { + if (typeof object.spokes[i] !== "object") + throw TypeError(".google.cloud.networkconnectivity.v1.ListSpokesResponse.spokes: object expected"); + message.spokes[i] = $root.google.cloud.networkconnectivity.v1.Spoke.fromObject(object.spokes[i]); + } + } + if (object.nextPageToken != null) + message.nextPageToken = String(object.nextPageToken); + if (object.unreachable) { + if (!Array.isArray(object.unreachable)) + throw TypeError(".google.cloud.networkconnectivity.v1.ListSpokesResponse.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 ListSpokesResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.networkconnectivity.v1.ListSpokesResponse + * @static + * @param {google.cloud.networkconnectivity.v1.ListSpokesResponse} message ListSpokesResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListSpokesResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.spokes = []; + object.unreachable = []; + } + if (options.defaults) + object.nextPageToken = ""; + if (message.spokes && message.spokes.length) { + object.spokes = []; + for (var j = 0; j < message.spokes.length; ++j) + object.spokes[j] = $root.google.cloud.networkconnectivity.v1.Spoke.toObject(message.spokes[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 ListSpokesResponse to JSON. + * @function toJSON + * @memberof google.cloud.networkconnectivity.v1.ListSpokesResponse + * @instance + * @returns {Object.} JSON object + */ + ListSpokesResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ListSpokesResponse; + })(); + + v1.GetSpokeRequest = (function() { + + /** + * Properties of a GetSpokeRequest. + * @memberof google.cloud.networkconnectivity.v1 + * @interface IGetSpokeRequest + * @property {string|null} [name] GetSpokeRequest name + */ + + /** + * Constructs a new GetSpokeRequest. + * @memberof google.cloud.networkconnectivity.v1 + * @classdesc Represents a GetSpokeRequest. + * @implements IGetSpokeRequest + * @constructor + * @param {google.cloud.networkconnectivity.v1.IGetSpokeRequest=} [properties] Properties to set + */ + function GetSpokeRequest(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]]; + } + + /** + * GetSpokeRequest name. + * @member {string} name + * @memberof google.cloud.networkconnectivity.v1.GetSpokeRequest + * @instance + */ + GetSpokeRequest.prototype.name = ""; + + /** + * Creates a new GetSpokeRequest instance using the specified properties. + * @function create + * @memberof google.cloud.networkconnectivity.v1.GetSpokeRequest + * @static + * @param {google.cloud.networkconnectivity.v1.IGetSpokeRequest=} [properties] Properties to set + * @returns {google.cloud.networkconnectivity.v1.GetSpokeRequest} GetSpokeRequest instance + */ + GetSpokeRequest.create = function create(properties) { + return new GetSpokeRequest(properties); + }; + + /** + * Encodes the specified GetSpokeRequest message. Does not implicitly {@link google.cloud.networkconnectivity.v1.GetSpokeRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.networkconnectivity.v1.GetSpokeRequest + * @static + * @param {google.cloud.networkconnectivity.v1.IGetSpokeRequest} message GetSpokeRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetSpokeRequest.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 GetSpokeRequest message, length delimited. Does not implicitly {@link google.cloud.networkconnectivity.v1.GetSpokeRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.networkconnectivity.v1.GetSpokeRequest + * @static + * @param {google.cloud.networkconnectivity.v1.IGetSpokeRequest} message GetSpokeRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetSpokeRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GetSpokeRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.networkconnectivity.v1.GetSpokeRequest + * @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.GetSpokeRequest} GetSpokeRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetSpokeRequest.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.GetSpokeRequest(); + 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 GetSpokeRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.networkconnectivity.v1.GetSpokeRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.networkconnectivity.v1.GetSpokeRequest} GetSpokeRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetSpokeRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GetSpokeRequest message. + * @function verify + * @memberof google.cloud.networkconnectivity.v1.GetSpokeRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GetSpokeRequest.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 GetSpokeRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.networkconnectivity.v1.GetSpokeRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.networkconnectivity.v1.GetSpokeRequest} GetSpokeRequest + */ + GetSpokeRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.networkconnectivity.v1.GetSpokeRequest) + return object; + var message = new $root.google.cloud.networkconnectivity.v1.GetSpokeRequest(); + if (object.name != null) + message.name = String(object.name); + return message; + }; + + /** + * Creates a plain object from a GetSpokeRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.networkconnectivity.v1.GetSpokeRequest + * @static + * @param {google.cloud.networkconnectivity.v1.GetSpokeRequest} message GetSpokeRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GetSpokeRequest.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 GetSpokeRequest to JSON. + * @function toJSON + * @memberof google.cloud.networkconnectivity.v1.GetSpokeRequest + * @instance + * @returns {Object.} JSON object + */ + GetSpokeRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return GetSpokeRequest; + })(); + + v1.CreateSpokeRequest = (function() { + + /** + * Properties of a CreateSpokeRequest. + * @memberof google.cloud.networkconnectivity.v1 + * @interface ICreateSpokeRequest + * @property {string|null} [parent] CreateSpokeRequest parent + * @property {string|null} [spokeId] CreateSpokeRequest spokeId + * @property {google.cloud.networkconnectivity.v1.ISpoke|null} [spoke] CreateSpokeRequest spoke + * @property {string|null} [requestId] CreateSpokeRequest requestId + */ + + /** + * Constructs a new CreateSpokeRequest. + * @memberof google.cloud.networkconnectivity.v1 + * @classdesc Represents a CreateSpokeRequest. + * @implements ICreateSpokeRequest + * @constructor + * @param {google.cloud.networkconnectivity.v1.ICreateSpokeRequest=} [properties] Properties to set + */ + function CreateSpokeRequest(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]]; + } + + /** + * CreateSpokeRequest parent. + * @member {string} parent + * @memberof google.cloud.networkconnectivity.v1.CreateSpokeRequest + * @instance + */ + CreateSpokeRequest.prototype.parent = ""; + + /** + * CreateSpokeRequest spokeId. + * @member {string} spokeId + * @memberof google.cloud.networkconnectivity.v1.CreateSpokeRequest + * @instance + */ + CreateSpokeRequest.prototype.spokeId = ""; + + /** + * CreateSpokeRequest spoke. + * @member {google.cloud.networkconnectivity.v1.ISpoke|null|undefined} spoke + * @memberof google.cloud.networkconnectivity.v1.CreateSpokeRequest + * @instance + */ + CreateSpokeRequest.prototype.spoke = null; + + /** + * CreateSpokeRequest requestId. + * @member {string} requestId + * @memberof google.cloud.networkconnectivity.v1.CreateSpokeRequest + * @instance + */ + CreateSpokeRequest.prototype.requestId = ""; + + /** + * Creates a new CreateSpokeRequest instance using the specified properties. + * @function create + * @memberof google.cloud.networkconnectivity.v1.CreateSpokeRequest + * @static + * @param {google.cloud.networkconnectivity.v1.ICreateSpokeRequest=} [properties] Properties to set + * @returns {google.cloud.networkconnectivity.v1.CreateSpokeRequest} CreateSpokeRequest instance + */ + CreateSpokeRequest.create = function create(properties) { + return new CreateSpokeRequest(properties); + }; + + /** + * Encodes the specified CreateSpokeRequest message. Does not implicitly {@link google.cloud.networkconnectivity.v1.CreateSpokeRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.networkconnectivity.v1.CreateSpokeRequest + * @static + * @param {google.cloud.networkconnectivity.v1.ICreateSpokeRequest} message CreateSpokeRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CreateSpokeRequest.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.spokeId != null && Object.hasOwnProperty.call(message, "spokeId")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.spokeId); + if (message.spoke != null && Object.hasOwnProperty.call(message, "spoke")) + $root.google.cloud.networkconnectivity.v1.Spoke.encode(message.spoke, 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 CreateSpokeRequest message, length delimited. Does not implicitly {@link google.cloud.networkconnectivity.v1.CreateSpokeRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.networkconnectivity.v1.CreateSpokeRequest + * @static + * @param {google.cloud.networkconnectivity.v1.ICreateSpokeRequest} message CreateSpokeRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CreateSpokeRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a CreateSpokeRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.networkconnectivity.v1.CreateSpokeRequest + * @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.CreateSpokeRequest} CreateSpokeRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CreateSpokeRequest.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.CreateSpokeRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.parent = reader.string(); + break; + case 2: + message.spokeId = reader.string(); + break; + case 3: + message.spoke = $root.google.cloud.networkconnectivity.v1.Spoke.decode(reader, reader.uint32()); + break; + case 4: + message.requestId = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a CreateSpokeRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.networkconnectivity.v1.CreateSpokeRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.networkconnectivity.v1.CreateSpokeRequest} CreateSpokeRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CreateSpokeRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a CreateSpokeRequest message. + * @function verify + * @memberof google.cloud.networkconnectivity.v1.CreateSpokeRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + CreateSpokeRequest.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.spokeId != null && message.hasOwnProperty("spokeId")) + if (!$util.isString(message.spokeId)) + return "spokeId: string expected"; + if (message.spoke != null && message.hasOwnProperty("spoke")) { + var error = $root.google.cloud.networkconnectivity.v1.Spoke.verify(message.spoke); + if (error) + return "spoke." + error; + } + if (message.requestId != null && message.hasOwnProperty("requestId")) + if (!$util.isString(message.requestId)) + return "requestId: string expected"; + return null; + }; + + /** + * Creates a CreateSpokeRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.networkconnectivity.v1.CreateSpokeRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.networkconnectivity.v1.CreateSpokeRequest} CreateSpokeRequest + */ + CreateSpokeRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.networkconnectivity.v1.CreateSpokeRequest) + return object; + var message = new $root.google.cloud.networkconnectivity.v1.CreateSpokeRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.spokeId != null) + message.spokeId = String(object.spokeId); + if (object.spoke != null) { + if (typeof object.spoke !== "object") + throw TypeError(".google.cloud.networkconnectivity.v1.CreateSpokeRequest.spoke: object expected"); + message.spoke = $root.google.cloud.networkconnectivity.v1.Spoke.fromObject(object.spoke); + } + if (object.requestId != null) + message.requestId = String(object.requestId); + return message; + }; + + /** + * Creates a plain object from a CreateSpokeRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.networkconnectivity.v1.CreateSpokeRequest + * @static + * @param {google.cloud.networkconnectivity.v1.CreateSpokeRequest} message CreateSpokeRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + CreateSpokeRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object.spokeId = ""; + object.spoke = null; + object.requestId = ""; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.spokeId != null && message.hasOwnProperty("spokeId")) + object.spokeId = message.spokeId; + if (message.spoke != null && message.hasOwnProperty("spoke")) + object.spoke = $root.google.cloud.networkconnectivity.v1.Spoke.toObject(message.spoke, options); + if (message.requestId != null && message.hasOwnProperty("requestId")) + object.requestId = message.requestId; + return object; + }; + + /** + * Converts this CreateSpokeRequest to JSON. + * @function toJSON + * @memberof google.cloud.networkconnectivity.v1.CreateSpokeRequest + * @instance + * @returns {Object.} JSON object + */ + CreateSpokeRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return CreateSpokeRequest; + })(); + + v1.UpdateSpokeRequest = (function() { + + /** + * Properties of an UpdateSpokeRequest. + * @memberof google.cloud.networkconnectivity.v1 + * @interface IUpdateSpokeRequest + * @property {google.protobuf.IFieldMask|null} [updateMask] UpdateSpokeRequest updateMask + * @property {google.cloud.networkconnectivity.v1.ISpoke|null} [spoke] UpdateSpokeRequest spoke + * @property {string|null} [requestId] UpdateSpokeRequest requestId + */ + + /** + * Constructs a new UpdateSpokeRequest. + * @memberof google.cloud.networkconnectivity.v1 + * @classdesc Represents an UpdateSpokeRequest. + * @implements IUpdateSpokeRequest + * @constructor + * @param {google.cloud.networkconnectivity.v1.IUpdateSpokeRequest=} [properties] Properties to set + */ + function UpdateSpokeRequest(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]]; + } + + /** + * UpdateSpokeRequest updateMask. + * @member {google.protobuf.IFieldMask|null|undefined} updateMask + * @memberof google.cloud.networkconnectivity.v1.UpdateSpokeRequest + * @instance + */ + UpdateSpokeRequest.prototype.updateMask = null; + + /** + * UpdateSpokeRequest spoke. + * @member {google.cloud.networkconnectivity.v1.ISpoke|null|undefined} spoke + * @memberof google.cloud.networkconnectivity.v1.UpdateSpokeRequest + * @instance + */ + UpdateSpokeRequest.prototype.spoke = null; + + /** + * UpdateSpokeRequest requestId. + * @member {string} requestId + * @memberof google.cloud.networkconnectivity.v1.UpdateSpokeRequest + * @instance + */ + UpdateSpokeRequest.prototype.requestId = ""; + + /** + * Creates a new UpdateSpokeRequest instance using the specified properties. + * @function create + * @memberof google.cloud.networkconnectivity.v1.UpdateSpokeRequest + * @static + * @param {google.cloud.networkconnectivity.v1.IUpdateSpokeRequest=} [properties] Properties to set + * @returns {google.cloud.networkconnectivity.v1.UpdateSpokeRequest} UpdateSpokeRequest instance + */ + UpdateSpokeRequest.create = function create(properties) { + return new UpdateSpokeRequest(properties); + }; + + /** + * Encodes the specified UpdateSpokeRequest message. Does not implicitly {@link google.cloud.networkconnectivity.v1.UpdateSpokeRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.networkconnectivity.v1.UpdateSpokeRequest + * @static + * @param {google.cloud.networkconnectivity.v1.IUpdateSpokeRequest} message UpdateSpokeRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UpdateSpokeRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.updateMask != null && Object.hasOwnProperty.call(message, "updateMask")) + $root.google.protobuf.FieldMask.encode(message.updateMask, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.spoke != null && Object.hasOwnProperty.call(message, "spoke")) + $root.google.cloud.networkconnectivity.v1.Spoke.encode(message.spoke, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.requestId != null && Object.hasOwnProperty.call(message, "requestId")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.requestId); + return writer; + }; + + /** + * Encodes the specified UpdateSpokeRequest message, length delimited. Does not implicitly {@link google.cloud.networkconnectivity.v1.UpdateSpokeRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.networkconnectivity.v1.UpdateSpokeRequest + * @static + * @param {google.cloud.networkconnectivity.v1.IUpdateSpokeRequest} message UpdateSpokeRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UpdateSpokeRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an UpdateSpokeRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.networkconnectivity.v1.UpdateSpokeRequest + * @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.UpdateSpokeRequest} UpdateSpokeRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UpdateSpokeRequest.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.UpdateSpokeRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.updateMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); + break; + case 2: + message.spoke = $root.google.cloud.networkconnectivity.v1.Spoke.decode(reader, reader.uint32()); + break; + case 3: + message.requestId = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an UpdateSpokeRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.networkconnectivity.v1.UpdateSpokeRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.networkconnectivity.v1.UpdateSpokeRequest} UpdateSpokeRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UpdateSpokeRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an UpdateSpokeRequest message. + * @function verify + * @memberof google.cloud.networkconnectivity.v1.UpdateSpokeRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + UpdateSpokeRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.updateMask != null && message.hasOwnProperty("updateMask")) { + var error = $root.google.protobuf.FieldMask.verify(message.updateMask); + if (error) + return "updateMask." + error; + } + if (message.spoke != null && message.hasOwnProperty("spoke")) { + var error = $root.google.cloud.networkconnectivity.v1.Spoke.verify(message.spoke); + if (error) + return "spoke." + error; + } + if (message.requestId != null && message.hasOwnProperty("requestId")) + if (!$util.isString(message.requestId)) + return "requestId: string expected"; + return null; + }; + + /** + * Creates an UpdateSpokeRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.networkconnectivity.v1.UpdateSpokeRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.networkconnectivity.v1.UpdateSpokeRequest} UpdateSpokeRequest + */ + UpdateSpokeRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.networkconnectivity.v1.UpdateSpokeRequest) + return object; + var message = new $root.google.cloud.networkconnectivity.v1.UpdateSpokeRequest(); + if (object.updateMask != null) { + if (typeof object.updateMask !== "object") + throw TypeError(".google.cloud.networkconnectivity.v1.UpdateSpokeRequest.updateMask: object expected"); + message.updateMask = $root.google.protobuf.FieldMask.fromObject(object.updateMask); + } + if (object.spoke != null) { + if (typeof object.spoke !== "object") + throw TypeError(".google.cloud.networkconnectivity.v1.UpdateSpokeRequest.spoke: object expected"); + message.spoke = $root.google.cloud.networkconnectivity.v1.Spoke.fromObject(object.spoke); + } + if (object.requestId != null) + message.requestId = String(object.requestId); + return message; + }; + + /** + * Creates a plain object from an UpdateSpokeRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.networkconnectivity.v1.UpdateSpokeRequest + * @static + * @param {google.cloud.networkconnectivity.v1.UpdateSpokeRequest} message UpdateSpokeRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + UpdateSpokeRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.updateMask = null; + object.spoke = null; + object.requestId = ""; + } + if (message.updateMask != null && message.hasOwnProperty("updateMask")) + object.updateMask = $root.google.protobuf.FieldMask.toObject(message.updateMask, options); + if (message.spoke != null && message.hasOwnProperty("spoke")) + object.spoke = $root.google.cloud.networkconnectivity.v1.Spoke.toObject(message.spoke, options); + if (message.requestId != null && message.hasOwnProperty("requestId")) + object.requestId = message.requestId; + return object; + }; + + /** + * Converts this UpdateSpokeRequest to JSON. + * @function toJSON + * @memberof google.cloud.networkconnectivity.v1.UpdateSpokeRequest + * @instance + * @returns {Object.} JSON object + */ + UpdateSpokeRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return UpdateSpokeRequest; + })(); + + v1.DeleteSpokeRequest = (function() { + + /** + * Properties of a DeleteSpokeRequest. + * @memberof google.cloud.networkconnectivity.v1 + * @interface IDeleteSpokeRequest + * @property {string|null} [name] DeleteSpokeRequest name + * @property {string|null} [requestId] DeleteSpokeRequest requestId + */ + + /** + * Constructs a new DeleteSpokeRequest. + * @memberof google.cloud.networkconnectivity.v1 + * @classdesc Represents a DeleteSpokeRequest. + * @implements IDeleteSpokeRequest + * @constructor + * @param {google.cloud.networkconnectivity.v1.IDeleteSpokeRequest=} [properties] Properties to set + */ + function DeleteSpokeRequest(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]]; + } + + /** + * DeleteSpokeRequest name. + * @member {string} name + * @memberof google.cloud.networkconnectivity.v1.DeleteSpokeRequest + * @instance + */ + DeleteSpokeRequest.prototype.name = ""; + + /** + * DeleteSpokeRequest requestId. + * @member {string} requestId + * @memberof google.cloud.networkconnectivity.v1.DeleteSpokeRequest + * @instance + */ + DeleteSpokeRequest.prototype.requestId = ""; + + /** + * Creates a new DeleteSpokeRequest instance using the specified properties. + * @function create + * @memberof google.cloud.networkconnectivity.v1.DeleteSpokeRequest + * @static + * @param {google.cloud.networkconnectivity.v1.IDeleteSpokeRequest=} [properties] Properties to set + * @returns {google.cloud.networkconnectivity.v1.DeleteSpokeRequest} DeleteSpokeRequest instance + */ + DeleteSpokeRequest.create = function create(properties) { + return new DeleteSpokeRequest(properties); + }; + + /** + * Encodes the specified DeleteSpokeRequest message. Does not implicitly {@link google.cloud.networkconnectivity.v1.DeleteSpokeRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.networkconnectivity.v1.DeleteSpokeRequest + * @static + * @param {google.cloud.networkconnectivity.v1.IDeleteSpokeRequest} message DeleteSpokeRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeleteSpokeRequest.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 DeleteSpokeRequest message, length delimited. Does not implicitly {@link google.cloud.networkconnectivity.v1.DeleteSpokeRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.networkconnectivity.v1.DeleteSpokeRequest + * @static + * @param {google.cloud.networkconnectivity.v1.IDeleteSpokeRequest} message DeleteSpokeRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeleteSpokeRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DeleteSpokeRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.networkconnectivity.v1.DeleteSpokeRequest + * @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.DeleteSpokeRequest} DeleteSpokeRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeleteSpokeRequest.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.DeleteSpokeRequest(); + 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 DeleteSpokeRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.networkconnectivity.v1.DeleteSpokeRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.networkconnectivity.v1.DeleteSpokeRequest} DeleteSpokeRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeleteSpokeRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DeleteSpokeRequest message. + * @function verify + * @memberof google.cloud.networkconnectivity.v1.DeleteSpokeRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DeleteSpokeRequest.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 DeleteSpokeRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.networkconnectivity.v1.DeleteSpokeRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.networkconnectivity.v1.DeleteSpokeRequest} DeleteSpokeRequest + */ + DeleteSpokeRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.networkconnectivity.v1.DeleteSpokeRequest) + return object; + var message = new $root.google.cloud.networkconnectivity.v1.DeleteSpokeRequest(); + 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 DeleteSpokeRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.networkconnectivity.v1.DeleteSpokeRequest + * @static + * @param {google.cloud.networkconnectivity.v1.DeleteSpokeRequest} message DeleteSpokeRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DeleteSpokeRequest.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 DeleteSpokeRequest to JSON. + * @function toJSON + * @memberof google.cloud.networkconnectivity.v1.DeleteSpokeRequest + * @instance + * @returns {Object.} JSON object + */ + DeleteSpokeRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return DeleteSpokeRequest; + })(); + + v1.DeactivateSpokeRequest = (function() { + + /** + * Properties of a DeactivateSpokeRequest. + * @memberof google.cloud.networkconnectivity.v1 + * @interface IDeactivateSpokeRequest + * @property {string|null} [name] DeactivateSpokeRequest name + * @property {string|null} [requestId] DeactivateSpokeRequest requestId + */ + + /** + * Constructs a new DeactivateSpokeRequest. + * @memberof google.cloud.networkconnectivity.v1 + * @classdesc Represents a DeactivateSpokeRequest. + * @implements IDeactivateSpokeRequest + * @constructor + * @param {google.cloud.networkconnectivity.v1.IDeactivateSpokeRequest=} [properties] Properties to set + */ + function DeactivateSpokeRequest(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]]; + } + + /** + * DeactivateSpokeRequest name. + * @member {string} name + * @memberof google.cloud.networkconnectivity.v1.DeactivateSpokeRequest + * @instance + */ + DeactivateSpokeRequest.prototype.name = ""; + + /** + * DeactivateSpokeRequest requestId. + * @member {string} requestId + * @memberof google.cloud.networkconnectivity.v1.DeactivateSpokeRequest + * @instance + */ + DeactivateSpokeRequest.prototype.requestId = ""; + + /** + * Creates a new DeactivateSpokeRequest instance using the specified properties. + * @function create + * @memberof google.cloud.networkconnectivity.v1.DeactivateSpokeRequest + * @static + * @param {google.cloud.networkconnectivity.v1.IDeactivateSpokeRequest=} [properties] Properties to set + * @returns {google.cloud.networkconnectivity.v1.DeactivateSpokeRequest} DeactivateSpokeRequest instance + */ + DeactivateSpokeRequest.create = function create(properties) { + return new DeactivateSpokeRequest(properties); + }; + + /** + * Encodes the specified DeactivateSpokeRequest message. Does not implicitly {@link google.cloud.networkconnectivity.v1.DeactivateSpokeRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.networkconnectivity.v1.DeactivateSpokeRequest + * @static + * @param {google.cloud.networkconnectivity.v1.IDeactivateSpokeRequest} message DeactivateSpokeRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeactivateSpokeRequest.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 DeactivateSpokeRequest message, length delimited. Does not implicitly {@link google.cloud.networkconnectivity.v1.DeactivateSpokeRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.networkconnectivity.v1.DeactivateSpokeRequest + * @static + * @param {google.cloud.networkconnectivity.v1.IDeactivateSpokeRequest} message DeactivateSpokeRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeactivateSpokeRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DeactivateSpokeRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.networkconnectivity.v1.DeactivateSpokeRequest + * @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.DeactivateSpokeRequest} DeactivateSpokeRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeactivateSpokeRequest.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.DeactivateSpokeRequest(); + 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 DeactivateSpokeRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.networkconnectivity.v1.DeactivateSpokeRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.networkconnectivity.v1.DeactivateSpokeRequest} DeactivateSpokeRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeactivateSpokeRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DeactivateSpokeRequest message. + * @function verify + * @memberof google.cloud.networkconnectivity.v1.DeactivateSpokeRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DeactivateSpokeRequest.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 DeactivateSpokeRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.networkconnectivity.v1.DeactivateSpokeRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.networkconnectivity.v1.DeactivateSpokeRequest} DeactivateSpokeRequest + */ + DeactivateSpokeRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.networkconnectivity.v1.DeactivateSpokeRequest) + return object; + var message = new $root.google.cloud.networkconnectivity.v1.DeactivateSpokeRequest(); + 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 DeactivateSpokeRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.networkconnectivity.v1.DeactivateSpokeRequest + * @static + * @param {google.cloud.networkconnectivity.v1.DeactivateSpokeRequest} message DeactivateSpokeRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DeactivateSpokeRequest.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 DeactivateSpokeRequest to JSON. + * @function toJSON + * @memberof google.cloud.networkconnectivity.v1.DeactivateSpokeRequest + * @instance + * @returns {Object.} JSON object + */ + DeactivateSpokeRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return DeactivateSpokeRequest; + })(); + + v1.ActivateSpokeRequest = (function() { + + /** + * Properties of an ActivateSpokeRequest. + * @memberof google.cloud.networkconnectivity.v1 + * @interface IActivateSpokeRequest + * @property {string|null} [name] ActivateSpokeRequest name + * @property {string|null} [requestId] ActivateSpokeRequest requestId + */ + + /** + * Constructs a new ActivateSpokeRequest. + * @memberof google.cloud.networkconnectivity.v1 + * @classdesc Represents an ActivateSpokeRequest. + * @implements IActivateSpokeRequest + * @constructor + * @param {google.cloud.networkconnectivity.v1.IActivateSpokeRequest=} [properties] Properties to set + */ + function ActivateSpokeRequest(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]]; + } + + /** + * ActivateSpokeRequest name. + * @member {string} name + * @memberof google.cloud.networkconnectivity.v1.ActivateSpokeRequest + * @instance + */ + ActivateSpokeRequest.prototype.name = ""; + + /** + * ActivateSpokeRequest requestId. + * @member {string} requestId + * @memberof google.cloud.networkconnectivity.v1.ActivateSpokeRequest + * @instance + */ + ActivateSpokeRequest.prototype.requestId = ""; + + /** + * Creates a new ActivateSpokeRequest instance using the specified properties. + * @function create + * @memberof google.cloud.networkconnectivity.v1.ActivateSpokeRequest + * @static + * @param {google.cloud.networkconnectivity.v1.IActivateSpokeRequest=} [properties] Properties to set + * @returns {google.cloud.networkconnectivity.v1.ActivateSpokeRequest} ActivateSpokeRequest instance + */ + ActivateSpokeRequest.create = function create(properties) { + return new ActivateSpokeRequest(properties); + }; + + /** + * Encodes the specified ActivateSpokeRequest message. Does not implicitly {@link google.cloud.networkconnectivity.v1.ActivateSpokeRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.networkconnectivity.v1.ActivateSpokeRequest + * @static + * @param {google.cloud.networkconnectivity.v1.IActivateSpokeRequest} message ActivateSpokeRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ActivateSpokeRequest.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 ActivateSpokeRequest message, length delimited. Does not implicitly {@link google.cloud.networkconnectivity.v1.ActivateSpokeRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.networkconnectivity.v1.ActivateSpokeRequest + * @static + * @param {google.cloud.networkconnectivity.v1.IActivateSpokeRequest} message ActivateSpokeRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ActivateSpokeRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an ActivateSpokeRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.networkconnectivity.v1.ActivateSpokeRequest + * @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.ActivateSpokeRequest} ActivateSpokeRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ActivateSpokeRequest.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.ActivateSpokeRequest(); + 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 an ActivateSpokeRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.networkconnectivity.v1.ActivateSpokeRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.networkconnectivity.v1.ActivateSpokeRequest} ActivateSpokeRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ActivateSpokeRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an ActivateSpokeRequest message. + * @function verify + * @memberof google.cloud.networkconnectivity.v1.ActivateSpokeRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ActivateSpokeRequest.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 an ActivateSpokeRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.networkconnectivity.v1.ActivateSpokeRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.networkconnectivity.v1.ActivateSpokeRequest} ActivateSpokeRequest + */ + ActivateSpokeRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.networkconnectivity.v1.ActivateSpokeRequest) + return object; + var message = new $root.google.cloud.networkconnectivity.v1.ActivateSpokeRequest(); + 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 an ActivateSpokeRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.networkconnectivity.v1.ActivateSpokeRequest + * @static + * @param {google.cloud.networkconnectivity.v1.ActivateSpokeRequest} message ActivateSpokeRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ActivateSpokeRequest.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 ActivateSpokeRequest to JSON. + * @function toJSON + * @memberof google.cloud.networkconnectivity.v1.ActivateSpokeRequest + * @instance + * @returns {Object.} JSON object + */ + ActivateSpokeRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ActivateSpokeRequest; + })(); + + v1.LinkedVpnTunnels = (function() { + + /** + * Properties of a LinkedVpnTunnels. + * @memberof google.cloud.networkconnectivity.v1 + * @interface ILinkedVpnTunnels + * @property {Array.|null} [uris] LinkedVpnTunnels uris + * @property {boolean|null} [siteToSiteDataTransfer] LinkedVpnTunnels siteToSiteDataTransfer + */ + + /** + * Constructs a new LinkedVpnTunnels. + * @memberof google.cloud.networkconnectivity.v1 + * @classdesc Represents a LinkedVpnTunnels. + * @implements ILinkedVpnTunnels + * @constructor + * @param {google.cloud.networkconnectivity.v1.ILinkedVpnTunnels=} [properties] Properties to set + */ + function LinkedVpnTunnels(properties) { + this.uris = []; + 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]]; + } + + /** + * LinkedVpnTunnels uris. + * @member {Array.} uris + * @memberof google.cloud.networkconnectivity.v1.LinkedVpnTunnels + * @instance + */ + LinkedVpnTunnels.prototype.uris = $util.emptyArray; + + /** + * LinkedVpnTunnels siteToSiteDataTransfer. + * @member {boolean} siteToSiteDataTransfer + * @memberof google.cloud.networkconnectivity.v1.LinkedVpnTunnels + * @instance + */ + LinkedVpnTunnels.prototype.siteToSiteDataTransfer = false; + + /** + * Creates a new LinkedVpnTunnels instance using the specified properties. + * @function create + * @memberof google.cloud.networkconnectivity.v1.LinkedVpnTunnels + * @static + * @param {google.cloud.networkconnectivity.v1.ILinkedVpnTunnels=} [properties] Properties to set + * @returns {google.cloud.networkconnectivity.v1.LinkedVpnTunnels} LinkedVpnTunnels instance + */ + LinkedVpnTunnels.create = function create(properties) { + return new LinkedVpnTunnels(properties); + }; + + /** + * Encodes the specified LinkedVpnTunnels message. Does not implicitly {@link google.cloud.networkconnectivity.v1.LinkedVpnTunnels.verify|verify} messages. + * @function encode + * @memberof google.cloud.networkconnectivity.v1.LinkedVpnTunnels + * @static + * @param {google.cloud.networkconnectivity.v1.ILinkedVpnTunnels} message LinkedVpnTunnels message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + LinkedVpnTunnels.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.uris != null && message.uris.length) + for (var i = 0; i < message.uris.length; ++i) + 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); + return writer; + }; + + /** + * Encodes the specified LinkedVpnTunnels message, length delimited. Does not implicitly {@link google.cloud.networkconnectivity.v1.LinkedVpnTunnels.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.networkconnectivity.v1.LinkedVpnTunnels + * @static + * @param {google.cloud.networkconnectivity.v1.ILinkedVpnTunnels} message LinkedVpnTunnels message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + LinkedVpnTunnels.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a LinkedVpnTunnels message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.networkconnectivity.v1.LinkedVpnTunnels + * @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.LinkedVpnTunnels} LinkedVpnTunnels + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + LinkedVpnTunnels.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.LinkedVpnTunnels(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.uris && message.uris.length)) + message.uris = []; + message.uris.push(reader.string()); + break; + case 2: + message.siteToSiteDataTransfer = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a LinkedVpnTunnels message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.networkconnectivity.v1.LinkedVpnTunnels + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.networkconnectivity.v1.LinkedVpnTunnels} LinkedVpnTunnels + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + LinkedVpnTunnels.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a LinkedVpnTunnels message. + * @function verify + * @memberof google.cloud.networkconnectivity.v1.LinkedVpnTunnels + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + LinkedVpnTunnels.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.uris != null && message.hasOwnProperty("uris")) { + if (!Array.isArray(message.uris)) + return "uris: array expected"; + for (var i = 0; i < message.uris.length; ++i) + if (!$util.isString(message.uris[i])) + return "uris: string[] expected"; + } + if (message.siteToSiteDataTransfer != null && message.hasOwnProperty("siteToSiteDataTransfer")) + if (typeof message.siteToSiteDataTransfer !== "boolean") + return "siteToSiteDataTransfer: boolean expected"; + return null; + }; + + /** + * Creates a LinkedVpnTunnels message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.networkconnectivity.v1.LinkedVpnTunnels + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.networkconnectivity.v1.LinkedVpnTunnels} LinkedVpnTunnels + */ + LinkedVpnTunnels.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.networkconnectivity.v1.LinkedVpnTunnels) + return object; + var message = new $root.google.cloud.networkconnectivity.v1.LinkedVpnTunnels(); + if (object.uris) { + if (!Array.isArray(object.uris)) + throw TypeError(".google.cloud.networkconnectivity.v1.LinkedVpnTunnels.uris: array expected"); + message.uris = []; + for (var i = 0; i < object.uris.length; ++i) + message.uris[i] = String(object.uris[i]); + } + if (object.siteToSiteDataTransfer != null) + message.siteToSiteDataTransfer = Boolean(object.siteToSiteDataTransfer); + return message; + }; + + /** + * Creates a plain object from a LinkedVpnTunnels message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.networkconnectivity.v1.LinkedVpnTunnels + * @static + * @param {google.cloud.networkconnectivity.v1.LinkedVpnTunnels} message LinkedVpnTunnels + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + LinkedVpnTunnels.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.uris = []; + if (options.defaults) + object.siteToSiteDataTransfer = false; + if (message.uris && message.uris.length) { + object.uris = []; + for (var j = 0; j < message.uris.length; ++j) + object.uris[j] = message.uris[j]; + } + if (message.siteToSiteDataTransfer != null && message.hasOwnProperty("siteToSiteDataTransfer")) + object.siteToSiteDataTransfer = message.siteToSiteDataTransfer; + return object; + }; + + /** + * Converts this LinkedVpnTunnels to JSON. + * @function toJSON + * @memberof google.cloud.networkconnectivity.v1.LinkedVpnTunnels + * @instance + * @returns {Object.} JSON object + */ + LinkedVpnTunnels.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return LinkedVpnTunnels; + })(); + + v1.LinkedInterconnectAttachments = (function() { + + /** + * Properties of a LinkedInterconnectAttachments. + * @memberof google.cloud.networkconnectivity.v1 + * @interface ILinkedInterconnectAttachments + * @property {Array.|null} [uris] LinkedInterconnectAttachments uris + * @property {boolean|null} [siteToSiteDataTransfer] LinkedInterconnectAttachments siteToSiteDataTransfer + */ + + /** + * Constructs a new LinkedInterconnectAttachments. + * @memberof google.cloud.networkconnectivity.v1 + * @classdesc Represents a LinkedInterconnectAttachments. + * @implements ILinkedInterconnectAttachments + * @constructor + * @param {google.cloud.networkconnectivity.v1.ILinkedInterconnectAttachments=} [properties] Properties to set + */ + function LinkedInterconnectAttachments(properties) { + this.uris = []; + 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]]; + } + + /** + * LinkedInterconnectAttachments uris. + * @member {Array.} uris + * @memberof google.cloud.networkconnectivity.v1.LinkedInterconnectAttachments + * @instance + */ + LinkedInterconnectAttachments.prototype.uris = $util.emptyArray; + + /** + * LinkedInterconnectAttachments siteToSiteDataTransfer. + * @member {boolean} siteToSiteDataTransfer + * @memberof google.cloud.networkconnectivity.v1.LinkedInterconnectAttachments + * @instance + */ + LinkedInterconnectAttachments.prototype.siteToSiteDataTransfer = false; + + /** + * Creates a new LinkedInterconnectAttachments instance using the specified properties. + * @function create + * @memberof google.cloud.networkconnectivity.v1.LinkedInterconnectAttachments + * @static + * @param {google.cloud.networkconnectivity.v1.ILinkedInterconnectAttachments=} [properties] Properties to set + * @returns {google.cloud.networkconnectivity.v1.LinkedInterconnectAttachments} LinkedInterconnectAttachments instance + */ + LinkedInterconnectAttachments.create = function create(properties) { + return new LinkedInterconnectAttachments(properties); + }; + + /** + * Encodes the specified LinkedInterconnectAttachments message. Does not implicitly {@link google.cloud.networkconnectivity.v1.LinkedInterconnectAttachments.verify|verify} messages. + * @function encode + * @memberof google.cloud.networkconnectivity.v1.LinkedInterconnectAttachments + * @static + * @param {google.cloud.networkconnectivity.v1.ILinkedInterconnectAttachments} message LinkedInterconnectAttachments message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + LinkedInterconnectAttachments.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.uris != null && message.uris.length) + for (var i = 0; i < message.uris.length; ++i) + 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); + return writer; + }; + + /** + * Encodes the specified LinkedInterconnectAttachments message, length delimited. Does not implicitly {@link google.cloud.networkconnectivity.v1.LinkedInterconnectAttachments.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.networkconnectivity.v1.LinkedInterconnectAttachments + * @static + * @param {google.cloud.networkconnectivity.v1.ILinkedInterconnectAttachments} message LinkedInterconnectAttachments message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + LinkedInterconnectAttachments.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a LinkedInterconnectAttachments message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.networkconnectivity.v1.LinkedInterconnectAttachments + * @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.LinkedInterconnectAttachments} LinkedInterconnectAttachments + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + LinkedInterconnectAttachments.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.LinkedInterconnectAttachments(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.uris && message.uris.length)) + message.uris = []; + message.uris.push(reader.string()); + break; + case 2: + message.siteToSiteDataTransfer = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a LinkedInterconnectAttachments message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.networkconnectivity.v1.LinkedInterconnectAttachments + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.networkconnectivity.v1.LinkedInterconnectAttachments} LinkedInterconnectAttachments + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + LinkedInterconnectAttachments.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a LinkedInterconnectAttachments message. + * @function verify + * @memberof google.cloud.networkconnectivity.v1.LinkedInterconnectAttachments + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + LinkedInterconnectAttachments.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.uris != null && message.hasOwnProperty("uris")) { + if (!Array.isArray(message.uris)) + return "uris: array expected"; + for (var i = 0; i < message.uris.length; ++i) + if (!$util.isString(message.uris[i])) + return "uris: string[] expected"; + } + if (message.siteToSiteDataTransfer != null && message.hasOwnProperty("siteToSiteDataTransfer")) + if (typeof message.siteToSiteDataTransfer !== "boolean") + return "siteToSiteDataTransfer: boolean expected"; + return null; + }; + + /** + * Creates a LinkedInterconnectAttachments message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.networkconnectivity.v1.LinkedInterconnectAttachments + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.networkconnectivity.v1.LinkedInterconnectAttachments} LinkedInterconnectAttachments + */ + LinkedInterconnectAttachments.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.networkconnectivity.v1.LinkedInterconnectAttachments) + return object; + var message = new $root.google.cloud.networkconnectivity.v1.LinkedInterconnectAttachments(); + if (object.uris) { + if (!Array.isArray(object.uris)) + throw TypeError(".google.cloud.networkconnectivity.v1.LinkedInterconnectAttachments.uris: array expected"); + message.uris = []; + for (var i = 0; i < object.uris.length; ++i) + message.uris[i] = String(object.uris[i]); + } + if (object.siteToSiteDataTransfer != null) + message.siteToSiteDataTransfer = Boolean(object.siteToSiteDataTransfer); + return message; + }; + + /** + * Creates a plain object from a LinkedInterconnectAttachments message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.networkconnectivity.v1.LinkedInterconnectAttachments + * @static + * @param {google.cloud.networkconnectivity.v1.LinkedInterconnectAttachments} message LinkedInterconnectAttachments + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + LinkedInterconnectAttachments.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.uris = []; + if (options.defaults) + object.siteToSiteDataTransfer = false; + if (message.uris && message.uris.length) { + object.uris = []; + for (var j = 0; j < message.uris.length; ++j) + object.uris[j] = message.uris[j]; + } + if (message.siteToSiteDataTransfer != null && message.hasOwnProperty("siteToSiteDataTransfer")) + object.siteToSiteDataTransfer = message.siteToSiteDataTransfer; + return object; + }; + + /** + * Converts this LinkedInterconnectAttachments to JSON. + * @function toJSON + * @memberof google.cloud.networkconnectivity.v1.LinkedInterconnectAttachments + * @instance + * @returns {Object.} JSON object + */ + LinkedInterconnectAttachments.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return LinkedInterconnectAttachments; + })(); + + v1.LinkedRouterApplianceInstances = (function() { + + /** + * Properties of a LinkedRouterApplianceInstances. + * @memberof google.cloud.networkconnectivity.v1 + * @interface ILinkedRouterApplianceInstances + * @property {Array.|null} [instances] LinkedRouterApplianceInstances instances + * @property {boolean|null} [siteToSiteDataTransfer] LinkedRouterApplianceInstances siteToSiteDataTransfer + */ + + /** + * Constructs a new LinkedRouterApplianceInstances. + * @memberof google.cloud.networkconnectivity.v1 + * @classdesc Represents a LinkedRouterApplianceInstances. + * @implements ILinkedRouterApplianceInstances + * @constructor + * @param {google.cloud.networkconnectivity.v1.ILinkedRouterApplianceInstances=} [properties] Properties to set + */ + function LinkedRouterApplianceInstances(properties) { + this.instances = []; + 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]]; + } + + /** + * LinkedRouterApplianceInstances instances. + * @member {Array.} instances + * @memberof google.cloud.networkconnectivity.v1.LinkedRouterApplianceInstances + * @instance + */ + LinkedRouterApplianceInstances.prototype.instances = $util.emptyArray; + + /** + * LinkedRouterApplianceInstances siteToSiteDataTransfer. + * @member {boolean} siteToSiteDataTransfer + * @memberof google.cloud.networkconnectivity.v1.LinkedRouterApplianceInstances + * @instance + */ + LinkedRouterApplianceInstances.prototype.siteToSiteDataTransfer = false; + + /** + * Creates a new LinkedRouterApplianceInstances instance using the specified properties. + * @function create + * @memberof google.cloud.networkconnectivity.v1.LinkedRouterApplianceInstances + * @static + * @param {google.cloud.networkconnectivity.v1.ILinkedRouterApplianceInstances=} [properties] Properties to set + * @returns {google.cloud.networkconnectivity.v1.LinkedRouterApplianceInstances} LinkedRouterApplianceInstances instance + */ + LinkedRouterApplianceInstances.create = function create(properties) { + return new LinkedRouterApplianceInstances(properties); + }; + + /** + * Encodes the specified LinkedRouterApplianceInstances message. Does not implicitly {@link google.cloud.networkconnectivity.v1.LinkedRouterApplianceInstances.verify|verify} messages. + * @function encode + * @memberof google.cloud.networkconnectivity.v1.LinkedRouterApplianceInstances + * @static + * @param {google.cloud.networkconnectivity.v1.ILinkedRouterApplianceInstances} message LinkedRouterApplianceInstances message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + LinkedRouterApplianceInstances.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.instances != null && message.instances.length) + for (var i = 0; i < message.instances.length; ++i) + $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); + return writer; + }; + + /** + * Encodes the specified LinkedRouterApplianceInstances message, length delimited. Does not implicitly {@link google.cloud.networkconnectivity.v1.LinkedRouterApplianceInstances.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.networkconnectivity.v1.LinkedRouterApplianceInstances + * @static + * @param {google.cloud.networkconnectivity.v1.ILinkedRouterApplianceInstances} message LinkedRouterApplianceInstances message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + LinkedRouterApplianceInstances.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a LinkedRouterApplianceInstances message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.networkconnectivity.v1.LinkedRouterApplianceInstances + * @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.LinkedRouterApplianceInstances} LinkedRouterApplianceInstances + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + LinkedRouterApplianceInstances.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.LinkedRouterApplianceInstances(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.instances && message.instances.length)) + message.instances = []; + message.instances.push($root.google.cloud.networkconnectivity.v1.RouterApplianceInstance.decode(reader, reader.uint32())); + break; + case 2: + message.siteToSiteDataTransfer = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a LinkedRouterApplianceInstances message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.networkconnectivity.v1.LinkedRouterApplianceInstances + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.networkconnectivity.v1.LinkedRouterApplianceInstances} LinkedRouterApplianceInstances + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + LinkedRouterApplianceInstances.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a LinkedRouterApplianceInstances message. + * @function verify + * @memberof google.cloud.networkconnectivity.v1.LinkedRouterApplianceInstances + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + LinkedRouterApplianceInstances.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.instances != null && message.hasOwnProperty("instances")) { + if (!Array.isArray(message.instances)) + return "instances: array expected"; + for (var i = 0; i < message.instances.length; ++i) { + var error = $root.google.cloud.networkconnectivity.v1.RouterApplianceInstance.verify(message.instances[i]); + if (error) + return "instances." + error; + } + } + if (message.siteToSiteDataTransfer != null && message.hasOwnProperty("siteToSiteDataTransfer")) + if (typeof message.siteToSiteDataTransfer !== "boolean") + return "siteToSiteDataTransfer: boolean expected"; + return null; + }; + + /** + * Creates a LinkedRouterApplianceInstances message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.networkconnectivity.v1.LinkedRouterApplianceInstances + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.networkconnectivity.v1.LinkedRouterApplianceInstances} LinkedRouterApplianceInstances + */ + LinkedRouterApplianceInstances.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.networkconnectivity.v1.LinkedRouterApplianceInstances) + return object; + var message = new $root.google.cloud.networkconnectivity.v1.LinkedRouterApplianceInstances(); + if (object.instances) { + if (!Array.isArray(object.instances)) + throw TypeError(".google.cloud.networkconnectivity.v1.LinkedRouterApplianceInstances.instances: array expected"); + message.instances = []; + for (var i = 0; i < object.instances.length; ++i) { + if (typeof object.instances[i] !== "object") + throw TypeError(".google.cloud.networkconnectivity.v1.LinkedRouterApplianceInstances.instances: object expected"); + message.instances[i] = $root.google.cloud.networkconnectivity.v1.RouterApplianceInstance.fromObject(object.instances[i]); + } + } + if (object.siteToSiteDataTransfer != null) + message.siteToSiteDataTransfer = Boolean(object.siteToSiteDataTransfer); + return message; + }; + + /** + * Creates a plain object from a LinkedRouterApplianceInstances message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.networkconnectivity.v1.LinkedRouterApplianceInstances + * @static + * @param {google.cloud.networkconnectivity.v1.LinkedRouterApplianceInstances} message LinkedRouterApplianceInstances + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + LinkedRouterApplianceInstances.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.instances = []; + if (options.defaults) + object.siteToSiteDataTransfer = false; + if (message.instances && message.instances.length) { + object.instances = []; + for (var j = 0; j < message.instances.length; ++j) + object.instances[j] = $root.google.cloud.networkconnectivity.v1.RouterApplianceInstance.toObject(message.instances[j], options); + } + if (message.siteToSiteDataTransfer != null && message.hasOwnProperty("siteToSiteDataTransfer")) + object.siteToSiteDataTransfer = message.siteToSiteDataTransfer; + return object; + }; + + /** + * Converts this LinkedRouterApplianceInstances to JSON. + * @function toJSON + * @memberof google.cloud.networkconnectivity.v1.LinkedRouterApplianceInstances + * @instance + * @returns {Object.} JSON object + */ + LinkedRouterApplianceInstances.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return LinkedRouterApplianceInstances; + })(); + + v1.RouterApplianceInstance = (function() { + + /** + * Properties of a RouterApplianceInstance. + * @memberof google.cloud.networkconnectivity.v1 + * @interface IRouterApplianceInstance + * @property {string|null} [virtualMachine] RouterApplianceInstance virtualMachine + * @property {string|null} [ipAddress] RouterApplianceInstance ipAddress + */ + + /** + * Constructs a new RouterApplianceInstance. + * @memberof google.cloud.networkconnectivity.v1 + * @classdesc Represents a RouterApplianceInstance. + * @implements IRouterApplianceInstance + * @constructor + * @param {google.cloud.networkconnectivity.v1.IRouterApplianceInstance=} [properties] Properties to set + */ + function RouterApplianceInstance(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]]; + } + + /** + * RouterApplianceInstance virtualMachine. + * @member {string} virtualMachine + * @memberof google.cloud.networkconnectivity.v1.RouterApplianceInstance + * @instance + */ + RouterApplianceInstance.prototype.virtualMachine = ""; + + /** + * RouterApplianceInstance ipAddress. + * @member {string} ipAddress + * @memberof google.cloud.networkconnectivity.v1.RouterApplianceInstance + * @instance + */ + RouterApplianceInstance.prototype.ipAddress = ""; + + /** + * Creates a new RouterApplianceInstance instance using the specified properties. + * @function create + * @memberof google.cloud.networkconnectivity.v1.RouterApplianceInstance + * @static + * @param {google.cloud.networkconnectivity.v1.IRouterApplianceInstance=} [properties] Properties to set + * @returns {google.cloud.networkconnectivity.v1.RouterApplianceInstance} RouterApplianceInstance instance + */ + RouterApplianceInstance.create = function create(properties) { + return new RouterApplianceInstance(properties); + }; + + /** + * Encodes the specified RouterApplianceInstance message. Does not implicitly {@link google.cloud.networkconnectivity.v1.RouterApplianceInstance.verify|verify} messages. + * @function encode + * @memberof google.cloud.networkconnectivity.v1.RouterApplianceInstance + * @static + * @param {google.cloud.networkconnectivity.v1.IRouterApplianceInstance} message RouterApplianceInstance message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RouterApplianceInstance.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.virtualMachine != null && Object.hasOwnProperty.call(message, "virtualMachine")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.virtualMachine); + if (message.ipAddress != null && Object.hasOwnProperty.call(message, "ipAddress")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.ipAddress); + return writer; + }; + + /** + * Encodes the specified RouterApplianceInstance message, length delimited. Does not implicitly {@link google.cloud.networkconnectivity.v1.RouterApplianceInstance.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.networkconnectivity.v1.RouterApplianceInstance + * @static + * @param {google.cloud.networkconnectivity.v1.IRouterApplianceInstance} message RouterApplianceInstance message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RouterApplianceInstance.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a RouterApplianceInstance message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.networkconnectivity.v1.RouterApplianceInstance + * @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.RouterApplianceInstance} RouterApplianceInstance + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RouterApplianceInstance.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.RouterApplianceInstance(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.virtualMachine = reader.string(); + break; + case 3: + message.ipAddress = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a RouterApplianceInstance message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.networkconnectivity.v1.RouterApplianceInstance + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.networkconnectivity.v1.RouterApplianceInstance} RouterApplianceInstance + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RouterApplianceInstance.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a RouterApplianceInstance message. + * @function verify + * @memberof google.cloud.networkconnectivity.v1.RouterApplianceInstance + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + RouterApplianceInstance.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.virtualMachine != null && message.hasOwnProperty("virtualMachine")) + if (!$util.isString(message.virtualMachine)) + return "virtualMachine: string expected"; + if (message.ipAddress != null && message.hasOwnProperty("ipAddress")) + if (!$util.isString(message.ipAddress)) + return "ipAddress: string expected"; + return null; + }; + + /** + * Creates a RouterApplianceInstance message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.networkconnectivity.v1.RouterApplianceInstance + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.networkconnectivity.v1.RouterApplianceInstance} RouterApplianceInstance + */ + RouterApplianceInstance.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.networkconnectivity.v1.RouterApplianceInstance) + return object; + var message = new $root.google.cloud.networkconnectivity.v1.RouterApplianceInstance(); + if (object.virtualMachine != null) + message.virtualMachine = String(object.virtualMachine); + if (object.ipAddress != null) + message.ipAddress = String(object.ipAddress); + return message; + }; + + /** + * Creates a plain object from a RouterApplianceInstance message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.networkconnectivity.v1.RouterApplianceInstance + * @static + * @param {google.cloud.networkconnectivity.v1.RouterApplianceInstance} message RouterApplianceInstance + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + RouterApplianceInstance.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.virtualMachine = ""; + object.ipAddress = ""; + } + if (message.virtualMachine != null && message.hasOwnProperty("virtualMachine")) + object.virtualMachine = message.virtualMachine; + if (message.ipAddress != null && message.hasOwnProperty("ipAddress")) + object.ipAddress = message.ipAddress; + return object; + }; + + /** + * Converts this RouterApplianceInstance to JSON. + * @function toJSON + * @memberof google.cloud.networkconnectivity.v1.RouterApplianceInstance + * @instance + * @returns {Object.} JSON object + */ + RouterApplianceInstance.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return RouterApplianceInstance; + })(); + + return v1; + })(); + networkconnectivity.v1alpha1 = (function() { /** diff --git a/protos/protos.json b/protos/protos.json index 28bdaf5..24259e6 100644 --- a/protos/protos.json +++ b/protos/protos.json @@ -6,6 +6,874 @@ "nested": { "networkconnectivity": { "nested": { + "v1": { + "options": { + "csharp_namespace": "Google.Cloud.NetworkConnectivity.V1", + "go_package": "google.golang.org/genproto/googleapis/cloud/networkconnectivity/v1;networkconnectivity", + "java_multiple_files": true, + "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/Network", + "(google.api.resource_definition).pattern": "projects/{project}/global/networks/{resource_id}" + }, + "nested": { + "OperationMetadata": { + "fields": { + "createTime": { + "type": "google.protobuf.Timestamp", + "id": 1, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "endTime": { + "type": "google.protobuf.Timestamp", + "id": 2, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "target": { + "type": "string", + "id": 3, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "verb": { + "type": "string", + "id": 4, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "statusMessage": { + "type": "string", + "id": 5, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "requestedCancellation": { + "type": "bool", + "id": 6, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "apiVersion": { + "type": "string", + "id": 7, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + } + } + }, + "HubService": { + "options": { + "(google.api.default_host)": "networkconnectivity.googleapis.com", + "(google.api.oauth_scopes)": "https://www.googleapis.com/auth/cloud-platform" + }, + "methods": { + "ListHubs": { + "requestType": "ListHubsRequest", + "responseType": "ListHubsResponse", + "options": { + "(google.api.http).get": "/v1/{parent=projects/*/locations/global}/hubs", + "(google.api.method_signature)": "parent" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v1/{parent=projects/*/locations/global}/hubs" + } + }, + { + "(google.api.method_signature)": "parent" + } + ] + }, + "GetHub": { + "requestType": "GetHubRequest", + "responseType": "Hub", + "options": { + "(google.api.http).get": "/v1/{name=projects/*/locations/global/hubs/*}", + "(google.api.method_signature)": "name" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v1/{name=projects/*/locations/global/hubs/*}" + } + }, + { + "(google.api.method_signature)": "name" + } + ] + }, + "CreateHub": { + "requestType": "CreateHubRequest", + "responseType": "google.longrunning.Operation", + "options": { + "(google.api.http).post": "/v1/{parent=projects/*/locations/global}/hubs", + "(google.api.http).body": "hub", + "(google.api.method_signature)": "parent,hub,hub_id", + "(google.longrunning.operation_info).response_type": "Hub", + "(google.longrunning.operation_info).metadata_type": "OperationMetadata" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v1/{parent=projects/*/locations/global}/hubs", + "body": "hub" + } + }, + { + "(google.api.method_signature)": "parent,hub,hub_id" + }, + { + "(google.longrunning.operation_info)": { + "response_type": "Hub", + "metadata_type": "OperationMetadata" + } + } + ] + }, + "UpdateHub": { + "requestType": "UpdateHubRequest", + "responseType": "google.longrunning.Operation", + "options": { + "(google.api.http).patch": "/v1/{hub.name=projects/*/locations/global/hubs/*}", + "(google.api.http).body": "hub", + "(google.api.method_signature)": "hub,update_mask", + "(google.longrunning.operation_info).response_type": "Hub", + "(google.longrunning.operation_info).metadata_type": "OperationMetadata" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "patch": "/v1/{hub.name=projects/*/locations/global/hubs/*}", + "body": "hub" + } + }, + { + "(google.api.method_signature)": "hub,update_mask" + }, + { + "(google.longrunning.operation_info)": { + "response_type": "Hub", + "metadata_type": "OperationMetadata" + } + } + ] + }, + "DeleteHub": { + "requestType": "DeleteHubRequest", + "responseType": "google.longrunning.Operation", + "options": { + "(google.api.http).delete": "/v1/{name=projects/*/locations/global/hubs/*}", + "(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/hubs/*}" + } + }, + { + "(google.api.method_signature)": "name" + }, + { + "(google.longrunning.operation_info)": { + "response_type": "google.protobuf.Empty", + "metadata_type": "OperationMetadata" + } + } + ] + }, + "ListSpokes": { + "requestType": "ListSpokesRequest", + "responseType": "ListSpokesResponse", + "options": { + "(google.api.http).get": "/v1/{parent=projects/*/locations/*}/spokes", + "(google.api.method_signature)": "parent" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v1/{parent=projects/*/locations/*}/spokes" + } + }, + { + "(google.api.method_signature)": "parent" + } + ] + }, + "GetSpoke": { + "requestType": "GetSpokeRequest", + "responseType": "Spoke", + "options": { + "(google.api.http).get": "/v1/{name=projects/*/locations/*/spokes/*}", + "(google.api.method_signature)": "name" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v1/{name=projects/*/locations/*/spokes/*}" + } + }, + { + "(google.api.method_signature)": "name" + } + ] + }, + "CreateSpoke": { + "requestType": "CreateSpokeRequest", + "responseType": "google.longrunning.Operation", + "options": { + "(google.api.http).post": "/v1/{parent=projects/*/locations/*}/spokes", + "(google.api.http).body": "spoke", + "(google.api.method_signature)": "parent,spoke,spoke_id", + "(google.longrunning.operation_info).response_type": "Spoke", + "(google.longrunning.operation_info).metadata_type": "OperationMetadata" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v1/{parent=projects/*/locations/*}/spokes", + "body": "spoke" + } + }, + { + "(google.api.method_signature)": "parent,spoke,spoke_id" + }, + { + "(google.longrunning.operation_info)": { + "response_type": "Spoke", + "metadata_type": "OperationMetadata" + } + } + ] + }, + "UpdateSpoke": { + "requestType": "UpdateSpokeRequest", + "responseType": "google.longrunning.Operation", + "options": { + "(google.api.http).patch": "/v1/{spoke.name=projects/*/locations/*/spokes/*}", + "(google.api.http).body": "spoke", + "(google.api.method_signature)": "spoke,update_mask", + "(google.longrunning.operation_info).response_type": "Spoke", + "(google.longrunning.operation_info).metadata_type": "OperationMetadata" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "patch": "/v1/{spoke.name=projects/*/locations/*/spokes/*}", + "body": "spoke" + } + }, + { + "(google.api.method_signature)": "spoke,update_mask" + }, + { + "(google.longrunning.operation_info)": { + "response_type": "Spoke", + "metadata_type": "OperationMetadata" + } + } + ] + }, + "DeactivateSpoke": { + "requestType": "DeactivateSpokeRequest", + "responseType": "google.longrunning.Operation", + "options": { + "(google.api.http).post": "/v1/{name=projects/*/locations/*/spokes/*}:deactivate", + "(google.api.http).body": "*", + "(google.api.method_signature)": "name", + "(google.longrunning.operation_info).response_type": "Spoke", + "(google.longrunning.operation_info).metadata_type": "OperationMetadata" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v1/{name=projects/*/locations/*/spokes/*}:deactivate", + "body": "*" + } + }, + { + "(google.api.method_signature)": "name" + }, + { + "(google.longrunning.operation_info)": { + "response_type": "Spoke", + "metadata_type": "OperationMetadata" + } + } + ] + }, + "ActivateSpoke": { + "requestType": "ActivateSpokeRequest", + "responseType": "google.longrunning.Operation", + "options": { + "(google.api.http).post": "/v1/{name=projects/*/locations/*/spokes/*}:activate", + "(google.api.http).body": "*", + "(google.api.method_signature)": "name", + "(google.longrunning.operation_info).response_type": "Spoke", + "(google.longrunning.operation_info).metadata_type": "OperationMetadata" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v1/{name=projects/*/locations/*/spokes/*}:activate", + "body": "*" + } + }, + { + "(google.api.method_signature)": "name" + }, + { + "(google.longrunning.operation_info)": { + "response_type": "Spoke", + "metadata_type": "OperationMetadata" + } + } + ] + }, + "DeleteSpoke": { + "requestType": "DeleteSpokeRequest", + "responseType": "google.longrunning.Operation", + "options": { + "(google.api.http).delete": "/v1/{name=projects/*/locations/*/spokes/*}", + "(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/*/spokes/*}" + } + }, + { + "(google.api.method_signature)": "name" + }, + { + "(google.longrunning.operation_info)": { + "response_type": "google.protobuf.Empty", + "metadata_type": "OperationMetadata" + } + } + ] + } + } + }, + "Hub": { + "options": { + "(google.api.resource).type": "networkconnectivity.googleapis.com/Hub", + "(google.api.resource).pattern": "projects/{project}/locations/global/hubs/{hub}" + }, + "fields": { + "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 + }, + "uniqueId": { + "type": "string", + "id": 8, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "state": { + "type": "State", + "id": 9, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + } + } + }, + "State": { + "values": { + "STATE_UNSPECIFIED": 0, + "CREATING": 1, + "ACTIVE": 2, + "DELETING": 3 + } + }, + "Spoke": { + "options": { + "(google.api.resource).type": "networkconnectivity.googleapis.com/Spoke", + "(google.api.resource).pattern": "projects/{project}/locations/{location}/spokes/{spoke}" + }, + "fields": { + "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 + }, + "hub": { + "type": "string", + "id": 6, + "options": { + "(google.api.field_behavior)": "IMMUTABLE", + "(google.api.resource_reference).type": "networkconnectivity.googleapis.com/Hub" + } + }, + "linkedVpnTunnels": { + "type": "LinkedVpnTunnels", + "id": 17 + }, + "linkedInterconnectAttachments": { + "type": "LinkedInterconnectAttachments", + "id": 18 + }, + "linkedRouterApplianceInstances": { + "type": "LinkedRouterApplianceInstances", + "id": 19 + }, + "uniqueId": { + "type": "string", + "id": 11, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "state": { + "type": "State", + "id": 15, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + } + } + }, + "ListHubsRequest": { + "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 + } + } + }, + "ListHubsResponse": { + "fields": { + "hubs": { + "rule": "repeated", + "type": "Hub", + "id": 1 + }, + "nextPageToken": { + "type": "string", + "id": 2 + }, + "unreachable": { + "rule": "repeated", + "type": "string", + "id": 3 + } + } + }, + "GetHubRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "networkconnectivity.googleapis.com/Hub" + } + } + } + }, + "CreateHubRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "locations.googleapis.com/Location" + } + }, + "hubId": { + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "hub": { + "type": "Hub", + "id": 3, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "requestId": { + "type": "string", + "id": 4, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + } + }, + "UpdateHubRequest": { + "fields": { + "updateMask": { + "type": "google.protobuf.FieldMask", + "id": 1, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "hub": { + "type": "Hub", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "requestId": { + "type": "string", + "id": 3, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + } + }, + "DeleteHubRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "networkconnectivity.googleapis.com/Hub" + } + }, + "requestId": { + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + } + }, + "ListSpokesRequest": { + "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 + } + } + }, + "ListSpokesResponse": { + "fields": { + "spokes": { + "rule": "repeated", + "type": "Spoke", + "id": 1 + }, + "nextPageToken": { + "type": "string", + "id": 2 + }, + "unreachable": { + "rule": "repeated", + "type": "string", + "id": 3 + } + } + }, + "GetSpokeRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "networkconnectivity.googleapis.com/Spoke" + } + } + } + }, + "CreateSpokeRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "locations.googleapis.com/Location" + } + }, + "spokeId": { + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "spoke": { + "type": "Spoke", + "id": 3, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "requestId": { + "type": "string", + "id": 4, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + } + }, + "UpdateSpokeRequest": { + "fields": { + "updateMask": { + "type": "google.protobuf.FieldMask", + "id": 1, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "spoke": { + "type": "Spoke", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "requestId": { + "type": "string", + "id": 3, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + } + }, + "DeleteSpokeRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "networkconnectivity.googleapis.com/Spoke" + } + }, + "requestId": { + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + } + }, + "DeactivateSpokeRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "networkconnectivity.googleapis.com/Spoke" + } + }, + "requestId": { + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + } + }, + "ActivateSpokeRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "networkconnectivity.googleapis.com/Spoke" + } + }, + "requestId": { + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + } + }, + "LinkedVpnTunnels": { + "fields": { + "uris": { + "rule": "repeated", + "type": "string", + "id": 1, + "options": { + "(google.api.resource_reference).type": "compute.googleapis.com/VpnTunnel" + } + }, + "siteToSiteDataTransfer": { + "type": "bool", + "id": 2 + } + } + }, + "LinkedInterconnectAttachments": { + "fields": { + "uris": { + "rule": "repeated", + "type": "string", + "id": 1, + "options": { + "(google.api.resource_reference).type": "compute.googleapis.com/InterconnectAttachment" + } + }, + "siteToSiteDataTransfer": { + "type": "bool", + "id": 2 + } + } + }, + "LinkedRouterApplianceInstances": { + "fields": { + "instances": { + "rule": "repeated", + "type": "RouterApplianceInstance", + "id": 1 + }, + "siteToSiteDataTransfer": { + "type": "bool", + "id": 2 + } + } + }, + "RouterApplianceInstance": { + "fields": { + "virtualMachine": { + "type": "string", + "id": 1, + "options": { + "(google.api.resource_reference).type": "compute.googleapis.com/Instance" + } + }, + "ipAddress": { + "type": "string", + "id": 3 + } + } + } + } + }, "v1alpha1": { "options": { "csharp_namespace": "Google.Cloud.NetworkConnectivity.V1Alpha1", diff --git a/src/index.ts b/src/index.ts index 2e50837..b452b62 100644 --- a/src/index.ts +++ b/src/index.ts @@ -16,12 +16,13 @@ // ** https://github.com/googleapis/synthtool ** // ** All changes to this file may be overwritten. ** +import * as v1 from './v1'; import * as v1alpha1 from './v1alpha1'; const HubServiceClient = v1alpha1.HubServiceClient; type HubServiceClient = v1alpha1.HubServiceClient; -export {v1alpha1, HubServiceClient}; -export default {v1alpha1, HubServiceClient}; +export {v1, v1alpha1, HubServiceClient}; +export default {v1, v1alpha1, HubServiceClient}; import * as protos from '../protos/protos'; export {protos}; diff --git a/src/v1/gapic_metadata.json b/src/v1/gapic_metadata.json new file mode 100644 index 0000000..e4c0031 --- /dev/null +++ b/src/v1/gapic_metadata.json @@ -0,0 +1,151 @@ +{ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", + "language": "typescript", + "protoPackage": "google.cloud.networkconnectivity.v1", + "libraryPackage": "@google-cloud/networkconnectivity", + "services": { + "HubService": { + "clients": { + "grpc": { + "libraryClient": "HubServiceClient", + "rpcs": { + "GetHub": { + "methods": [ + "getHub" + ] + }, + "GetSpoke": { + "methods": [ + "getSpoke" + ] + }, + "CreateHub": { + "methods": [ + "createHub" + ] + }, + "UpdateHub": { + "methods": [ + "updateHub" + ] + }, + "DeleteHub": { + "methods": [ + "deleteHub" + ] + }, + "CreateSpoke": { + "methods": [ + "createSpoke" + ] + }, + "UpdateSpoke": { + "methods": [ + "updateSpoke" + ] + }, + "DeactivateSpoke": { + "methods": [ + "deactivateSpoke" + ] + }, + "ActivateSpoke": { + "methods": [ + "activateSpoke" + ] + }, + "DeleteSpoke": { + "methods": [ + "deleteSpoke" + ] + }, + "ListHubs": { + "methods": [ + "listHubs", + "listHubsStream", + "listHubsAsync" + ] + }, + "ListSpokes": { + "methods": [ + "listSpokes", + "listSpokesStream", + "listSpokesAsync" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "HubServiceClient", + "rpcs": { + "GetHub": { + "methods": [ + "getHub" + ] + }, + "GetSpoke": { + "methods": [ + "getSpoke" + ] + }, + "CreateHub": { + "methods": [ + "createHub" + ] + }, + "UpdateHub": { + "methods": [ + "updateHub" + ] + }, + "DeleteHub": { + "methods": [ + "deleteHub" + ] + }, + "CreateSpoke": { + "methods": [ + "createSpoke" + ] + }, + "UpdateSpoke": { + "methods": [ + "updateSpoke" + ] + }, + "DeactivateSpoke": { + "methods": [ + "deactivateSpoke" + ] + }, + "ActivateSpoke": { + "methods": [ + "activateSpoke" + ] + }, + "DeleteSpoke": { + "methods": [ + "deleteSpoke" + ] + }, + "ListHubs": { + "methods": [ + "listHubs", + "listHubsStream", + "listHubsAsync" + ] + }, + "ListSpokes": { + "methods": [ + "listSpokes", + "listSpokesStream", + "listSpokesAsync" + ] + } + } + } + } + } + } +} diff --git a/src/v1/hub_service_client.ts b/src/v1/hub_service_client.ts new file mode 100644 index 0000000..44e29a7 --- /dev/null +++ b/src/v1/hub_service_client.ts @@ -0,0 +1,2618 @@ +// Copyright 2021 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 * as gax from 'google-gax'; +import { + Callback, + CallOptions, + Descriptors, + ClientOptions, + LROperation, + PaginationCallback, + GaxCall, +} from 'google-gax'; + +import {Transform} from 'stream'; +import {RequestType} from 'google-gax/build/src/apitypes'; +import * as protos from '../../protos/protos'; +import jsonProtos = require('../../protos/protos.json'); +/** + * Client JSON configuration object, loaded from + * `src/v1/hub_service_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './hub_service_client_config.json'; +import {operationsProtos} from 'google-gax'; +const version = require('../../../package.json').version; + +/** + * 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. + * @class + * @memberof v1 + */ +export class HubServiceClient { + 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}; + pathTemplates: {[name: string]: gax.PathTemplate}; + operationsClient: gax.OperationsClient; + hubServiceStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of HubServiceClient. + * + * @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/master/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} [options.fallback] - Use HTTP fallback mode. + * In fallback mode, a special browser-compatible transport implementation is used + * instead of gRPC transport. In browser context (if the `window` object is defined) + * the fallback mode is enabled automatically; set `options.fallback` to `false` + * if you need to override this behavior. + */ + constructor(opts?: ClientOptions) { + // Ensure that options include all the required fields. + const staticMembers = this.constructor as typeof HubServiceClient; + 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); + + // 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; + } + + // Choose either gRPC or proto-over-HTTP implementation of google-gax. + this._gaxModule = opts.fallback ? gax.fallback : gax; + + // 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 the default scopes in auth client if needed. + if (servicePath === staticMembers.servicePath) { + this.auth.defaultScopes = staticMembers.scopes; + } + + // 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}' + ), + instancePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/zones/{zone}/instances/{instance}' + ), + interconnectAttachmentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/regions/{region}/interconnectAttachments/{resource_id}' + ), + locationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}' + ), + spokePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/spokes/{spoke}' + ), + vpnTunnelPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/regions/{region}/vpnTunnels/{resource_id}' + ), + }; + + // 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 = { + listHubs: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'hubs' + ), + listSpokes: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'spokes' + ), + }; + + 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. + + this.operationsClient = this._gaxModule + .lro({ + auth: this.auth, + grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined, + }) + .operationsClient(opts); + const createHubResponse = protoFilesRoot.lookup( + '.google.cloud.networkconnectivity.v1.Hub' + ) as gax.protobuf.Type; + const createHubMetadata = protoFilesRoot.lookup( + '.google.cloud.networkconnectivity.v1.OperationMetadata' + ) as gax.protobuf.Type; + const updateHubResponse = protoFilesRoot.lookup( + '.google.cloud.networkconnectivity.v1.Hub' + ) as gax.protobuf.Type; + const updateHubMetadata = protoFilesRoot.lookup( + '.google.cloud.networkconnectivity.v1.OperationMetadata' + ) as gax.protobuf.Type; + const deleteHubResponse = protoFilesRoot.lookup( + '.google.protobuf.Empty' + ) as gax.protobuf.Type; + const deleteHubMetadata = protoFilesRoot.lookup( + '.google.cloud.networkconnectivity.v1.OperationMetadata' + ) as gax.protobuf.Type; + const createSpokeResponse = protoFilesRoot.lookup( + '.google.cloud.networkconnectivity.v1.Spoke' + ) as gax.protobuf.Type; + const createSpokeMetadata = protoFilesRoot.lookup( + '.google.cloud.networkconnectivity.v1.OperationMetadata' + ) as gax.protobuf.Type; + const updateSpokeResponse = protoFilesRoot.lookup( + '.google.cloud.networkconnectivity.v1.Spoke' + ) as gax.protobuf.Type; + const updateSpokeMetadata = protoFilesRoot.lookup( + '.google.cloud.networkconnectivity.v1.OperationMetadata' + ) as gax.protobuf.Type; + const deactivateSpokeResponse = protoFilesRoot.lookup( + '.google.cloud.networkconnectivity.v1.Spoke' + ) as gax.protobuf.Type; + const deactivateSpokeMetadata = protoFilesRoot.lookup( + '.google.cloud.networkconnectivity.v1.OperationMetadata' + ) as gax.protobuf.Type; + const activateSpokeResponse = protoFilesRoot.lookup( + '.google.cloud.networkconnectivity.v1.Spoke' + ) as gax.protobuf.Type; + const activateSpokeMetadata = protoFilesRoot.lookup( + '.google.cloud.networkconnectivity.v1.OperationMetadata' + ) as gax.protobuf.Type; + const deleteSpokeResponse = protoFilesRoot.lookup( + '.google.protobuf.Empty' + ) as gax.protobuf.Type; + const deleteSpokeMetadata = protoFilesRoot.lookup( + '.google.cloud.networkconnectivity.v1.OperationMetadata' + ) as gax.protobuf.Type; + + this.descriptors.longrunning = { + createHub: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + createHubResponse.decode.bind(createHubResponse), + createHubMetadata.decode.bind(createHubMetadata) + ), + updateHub: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + updateHubResponse.decode.bind(updateHubResponse), + updateHubMetadata.decode.bind(updateHubMetadata) + ), + deleteHub: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + deleteHubResponse.decode.bind(deleteHubResponse), + deleteHubMetadata.decode.bind(deleteHubMetadata) + ), + createSpoke: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + createSpokeResponse.decode.bind(createSpokeResponse), + createSpokeMetadata.decode.bind(createSpokeMetadata) + ), + updateSpoke: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + updateSpokeResponse.decode.bind(updateSpokeResponse), + updateSpokeMetadata.decode.bind(updateSpokeMetadata) + ), + deactivateSpoke: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + deactivateSpokeResponse.decode.bind(deactivateSpokeResponse), + deactivateSpokeMetadata.decode.bind(deactivateSpokeMetadata) + ), + activateSpoke: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + activateSpokeResponse.decode.bind(activateSpokeResponse), + activateSpokeMetadata.decode.bind(activateSpokeMetadata) + ), + deleteSpoke: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + deleteSpokeResponse.decode.bind(deleteSpokeResponse), + deleteSpokeMetadata.decode.bind(deleteSpokeMetadata) + ), + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.networkconnectivity.v1.HubService', + 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 = gax.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.hubServiceStub) { + return this.hubServiceStub; + } + + // Put together the "service stub" for + // google.cloud.networkconnectivity.v1.HubService. + this.hubServiceStub = this._gaxGrpc.createStub( + this._opts.fallback + ? (this._protos as protobuf.Root).lookupService( + 'google.cloud.networkconnectivity.v1.HubService' + ) + : // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.networkconnectivity.v1.HubService, + 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 hubServiceStubMethods = [ + 'listHubs', + 'getHub', + 'createHub', + 'updateHub', + 'deleteHub', + 'listSpokes', + 'getSpoke', + 'createSpoke', + 'updateSpoke', + 'deactivateSpoke', + 'activateSpoke', + 'deleteSpoke', + ]; + for (const methodName of hubServiceStubMethods) { + const callPromise = this.hubServiceStub.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.innerApiCalls[methodName] = apiCall; + } + + return this.hubServiceStub; + } + + /** + * 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 -- + // ------------------- + getHub( + request?: protos.google.cloud.networkconnectivity.v1.IGetHubRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.networkconnectivity.v1.IHub, + protos.google.cloud.networkconnectivity.v1.IGetHubRequest | undefined, + {} | undefined + ] + >; + getHub( + request: protos.google.cloud.networkconnectivity.v1.IGetHubRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.networkconnectivity.v1.IHub, + | protos.google.cloud.networkconnectivity.v1.IGetHubRequest + | null + | undefined, + {} | null | undefined + > + ): void; + getHub( + request: protos.google.cloud.networkconnectivity.v1.IGetHubRequest, + callback: Callback< + protos.google.cloud.networkconnectivity.v1.IHub, + | protos.google.cloud.networkconnectivity.v1.IGetHubRequest + | null + | undefined, + {} | null | undefined + > + ): void; + /** + * Gets details about the specified hub. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the hub 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 [Hub]{@link google.cloud.networkconnectivity.v1.Hub}. + * 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.getHub(request); + */ + getHub( + request?: protos.google.cloud.networkconnectivity.v1.IGetHubRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.networkconnectivity.v1.IHub, + | protos.google.cloud.networkconnectivity.v1.IGetHubRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.networkconnectivity.v1.IHub, + | protos.google.cloud.networkconnectivity.v1.IGetHubRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.networkconnectivity.v1.IHub, + protos.google.cloud.networkconnectivity.v1.IGetHubRequest | 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'] = + gax.routingHeader.fromParams({ + name: request.name || '', + }); + this.initialize(); + return this.innerApiCalls.getHub(request, options, callback); + } + getSpoke( + request?: protos.google.cloud.networkconnectivity.v1.IGetSpokeRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.networkconnectivity.v1.ISpoke, + protos.google.cloud.networkconnectivity.v1.IGetSpokeRequest | undefined, + {} | undefined + ] + >; + getSpoke( + request: protos.google.cloud.networkconnectivity.v1.IGetSpokeRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.networkconnectivity.v1.ISpoke, + | protos.google.cloud.networkconnectivity.v1.IGetSpokeRequest + | null + | undefined, + {} | null | undefined + > + ): void; + getSpoke( + request: protos.google.cloud.networkconnectivity.v1.IGetSpokeRequest, + callback: Callback< + protos.google.cloud.networkconnectivity.v1.ISpoke, + | protos.google.cloud.networkconnectivity.v1.IGetSpokeRequest + | null + | undefined, + {} | null | undefined + > + ): void; + /** + * Gets details about the specified spoke. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the spoke resource. + * @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 [Spoke]{@link google.cloud.networkconnectivity.v1.Spoke}. + * 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.getSpoke(request); + */ + getSpoke( + request?: protos.google.cloud.networkconnectivity.v1.IGetSpokeRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.networkconnectivity.v1.ISpoke, + | protos.google.cloud.networkconnectivity.v1.IGetSpokeRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.networkconnectivity.v1.ISpoke, + | protos.google.cloud.networkconnectivity.v1.IGetSpokeRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.networkconnectivity.v1.ISpoke, + protos.google.cloud.networkconnectivity.v1.IGetSpokeRequest | 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'] = + gax.routingHeader.fromParams({ + name: request.name || '', + }); + this.initialize(); + return this.innerApiCalls.getSpoke(request, options, callback); + } + + createHub( + request?: protos.google.cloud.networkconnectivity.v1.ICreateHubRequest, + options?: CallOptions + ): Promise< + [ + LROperation< + protos.google.cloud.networkconnectivity.v1.IHub, + protos.google.cloud.networkconnectivity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined + ] + >; + createHub( + request: protos.google.cloud.networkconnectivity.v1.ICreateHubRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.networkconnectivity.v1.IHub, + protos.google.cloud.networkconnectivity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + createHub( + request: protos.google.cloud.networkconnectivity.v1.ICreateHubRequest, + callback: Callback< + LROperation< + protos.google.cloud.networkconnectivity.v1.IHub, + protos.google.cloud.networkconnectivity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + /** + * Creates a new hub in the specified project. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource. + * @param {string} [request.hubId] + * Optional. A unique identifier for the hub. + * @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. + * + * 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 + * was received. If it was, the server ignores the second request. This + * behavior prevents clients from mistakenly 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 + * const [operation] = await client.createHub(request); + * const [response] = await operation.promise(); + */ + createHub( + request?: protos.google.cloud.networkconnectivity.v1.ICreateHubRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.networkconnectivity.v1.IHub, + protos.google.cloud.networkconnectivity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.networkconnectivity.v1.IHub, + protos.google.cloud.networkconnectivity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): Promise< + [ + LROperation< + protos.google.cloud.networkconnectivity.v1.IHub, + 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'] = + gax.routingHeader.fromParams({ + parent: request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.createHub(request, options, callback); + } + /** + * Check the status of the long running operation returned by `createHub()`. + * @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 + * const decodedOperation = await checkCreateHubProgress(name); + * console.log(decodedOperation.result); + * console.log(decodedOperation.done); + * console.log(decodedOperation.metadata); + */ + async checkCreateHubProgress( + name: string + ): Promise< + LROperation< + protos.google.cloud.networkconnectivity.v1.Hub, + protos.google.cloud.networkconnectivity.v1.OperationMetadata + > + > { + const request = new operationsProtos.google.longrunning.GetOperationRequest( + {name} + ); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new gax.Operation( + operation, + this.descriptors.longrunning.createHub, + gax.createDefaultBackoffSettings() + ); + return decodeOperation as LROperation< + protos.google.cloud.networkconnectivity.v1.Hub, + protos.google.cloud.networkconnectivity.v1.OperationMetadata + >; + } + updateHub( + request?: protos.google.cloud.networkconnectivity.v1.IUpdateHubRequest, + options?: CallOptions + ): Promise< + [ + LROperation< + protos.google.cloud.networkconnectivity.v1.IHub, + protos.google.cloud.networkconnectivity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined + ] + >; + updateHub( + request: protos.google.cloud.networkconnectivity.v1.IUpdateHubRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.networkconnectivity.v1.IHub, + protos.google.cloud.networkconnectivity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + updateHub( + request: protos.google.cloud.networkconnectivity.v1.IUpdateHubRequest, + callback: Callback< + LROperation< + protos.google.cloud.networkconnectivity.v1.IHub, + protos.google.cloud.networkconnectivity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + /** + * 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. + * @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. + * + * 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 + * was received. If it was, the server ignores the second request. This + * behavior prevents clients from mistakenly 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 + * const [operation] = await client.updateHub(request); + * const [response] = await operation.promise(); + */ + updateHub( + request?: protos.google.cloud.networkconnectivity.v1.IUpdateHubRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.networkconnectivity.v1.IHub, + protos.google.cloud.networkconnectivity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.networkconnectivity.v1.IHub, + protos.google.cloud.networkconnectivity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): Promise< + [ + LROperation< + protos.google.cloud.networkconnectivity.v1.IHub, + 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'] = + gax.routingHeader.fromParams({ + 'hub.name': request.hub!.name || '', + }); + this.initialize(); + return this.innerApiCalls.updateHub(request, options, callback); + } + /** + * Check the status of the long running operation returned by `updateHub()`. + * @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 + * const decodedOperation = await checkUpdateHubProgress(name); + * console.log(decodedOperation.result); + * console.log(decodedOperation.done); + * console.log(decodedOperation.metadata); + */ + async checkUpdateHubProgress( + name: string + ): Promise< + LROperation< + protos.google.cloud.networkconnectivity.v1.Hub, + protos.google.cloud.networkconnectivity.v1.OperationMetadata + > + > { + const request = new operationsProtos.google.longrunning.GetOperationRequest( + {name} + ); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new gax.Operation( + operation, + this.descriptors.longrunning.updateHub, + gax.createDefaultBackoffSettings() + ); + return decodeOperation as LROperation< + protos.google.cloud.networkconnectivity.v1.Hub, + protos.google.cloud.networkconnectivity.v1.OperationMetadata + >; + } + deleteHub( + request?: protos.google.cloud.networkconnectivity.v1.IDeleteHubRequest, + options?: CallOptions + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networkconnectivity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined + ] + >; + deleteHub( + request: protos.google.cloud.networkconnectivity.v1.IDeleteHubRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networkconnectivity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + deleteHub( + request: protos.google.cloud.networkconnectivity.v1.IDeleteHubRequest, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networkconnectivity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + /** + * 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. + * + * 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 + * was received. If it was, the server ignores the second request. This + * behavior prevents clients from mistakenly 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 + * const [operation] = await client.deleteHub(request); + * const [response] = await operation.promise(); + */ + deleteHub( + request?: protos.google.cloud.networkconnectivity.v1.IDeleteHubRequest, + 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'] = + gax.routingHeader.fromParams({ + name: request.name || '', + }); + this.initialize(); + return this.innerApiCalls.deleteHub(request, options, callback); + } + /** + * Check the status of the long running operation returned by `deleteHub()`. + * @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 + * const decodedOperation = await checkDeleteHubProgress(name); + * console.log(decodedOperation.result); + * console.log(decodedOperation.done); + * console.log(decodedOperation.metadata); + */ + async checkDeleteHubProgress( + name: string + ): Promise< + LROperation< + protos.google.protobuf.Empty, + protos.google.cloud.networkconnectivity.v1.OperationMetadata + > + > { + const request = new operationsProtos.google.longrunning.GetOperationRequest( + {name} + ); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new gax.Operation( + operation, + this.descriptors.longrunning.deleteHub, + gax.createDefaultBackoffSettings() + ); + return decodeOperation as LROperation< + protos.google.protobuf.Empty, + protos.google.cloud.networkconnectivity.v1.OperationMetadata + >; + } + createSpoke( + request?: protos.google.cloud.networkconnectivity.v1.ICreateSpokeRequest, + options?: CallOptions + ): Promise< + [ + LROperation< + protos.google.cloud.networkconnectivity.v1.ISpoke, + protos.google.cloud.networkconnectivity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined + ] + >; + createSpoke( + request: protos.google.cloud.networkconnectivity.v1.ICreateSpokeRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.networkconnectivity.v1.ISpoke, + protos.google.cloud.networkconnectivity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + createSpoke( + request: protos.google.cloud.networkconnectivity.v1.ICreateSpokeRequest, + callback: Callback< + LROperation< + protos.google.cloud.networkconnectivity.v1.ISpoke, + protos.google.cloud.networkconnectivity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + /** + * Creates a spoke in the specified project and location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource. + * @param {string} [request.spokeId] + * Optional. Unique id for the spoke to create. + * @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. + * + * 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 + * was received. If it was, the server ignores the second request. This + * behavior prevents clients from mistakenly 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 + * const [operation] = await client.createSpoke(request); + * const [response] = await operation.promise(); + */ + createSpoke( + request?: protos.google.cloud.networkconnectivity.v1.ICreateSpokeRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.networkconnectivity.v1.ISpoke, + protos.google.cloud.networkconnectivity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.networkconnectivity.v1.ISpoke, + protos.google.cloud.networkconnectivity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): Promise< + [ + LROperation< + protos.google.cloud.networkconnectivity.v1.ISpoke, + 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'] = + gax.routingHeader.fromParams({ + parent: request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.createSpoke(request, options, callback); + } + /** + * Check the status of the long running operation returned by `createSpoke()`. + * @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 + * const decodedOperation = await checkCreateSpokeProgress(name); + * console.log(decodedOperation.result); + * console.log(decodedOperation.done); + * console.log(decodedOperation.metadata); + */ + async checkCreateSpokeProgress( + name: string + ): Promise< + LROperation< + protos.google.cloud.networkconnectivity.v1.Spoke, + protos.google.cloud.networkconnectivity.v1.OperationMetadata + > + > { + const request = new operationsProtos.google.longrunning.GetOperationRequest( + {name} + ); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new gax.Operation( + operation, + this.descriptors.longrunning.createSpoke, + gax.createDefaultBackoffSettings() + ); + return decodeOperation as LROperation< + protos.google.cloud.networkconnectivity.v1.Spoke, + protos.google.cloud.networkconnectivity.v1.OperationMetadata + >; + } + updateSpoke( + request?: protos.google.cloud.networkconnectivity.v1.IUpdateSpokeRequest, + options?: CallOptions + ): Promise< + [ + LROperation< + protos.google.cloud.networkconnectivity.v1.ISpoke, + protos.google.cloud.networkconnectivity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined + ] + >; + updateSpoke( + request: protos.google.cloud.networkconnectivity.v1.IUpdateSpokeRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.networkconnectivity.v1.ISpoke, + protos.google.cloud.networkconnectivity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + updateSpoke( + request: protos.google.cloud.networkconnectivity.v1.IUpdateSpokeRequest, + callback: Callback< + LROperation< + protos.google.cloud.networkconnectivity.v1.ISpoke, + protos.google.cloud.networkconnectivity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + /** + * 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 + * 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. + * + * 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 + * was received. If it was, the server ignores the second request. This + * behavior prevents clients from mistakenly 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 + * const [operation] = await client.updateSpoke(request); + * const [response] = await operation.promise(); + */ + updateSpoke( + request?: protos.google.cloud.networkconnectivity.v1.IUpdateSpokeRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.networkconnectivity.v1.ISpoke, + protos.google.cloud.networkconnectivity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.networkconnectivity.v1.ISpoke, + protos.google.cloud.networkconnectivity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): Promise< + [ + LROperation< + protos.google.cloud.networkconnectivity.v1.ISpoke, + 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'] = + gax.routingHeader.fromParams({ + 'spoke.name': request.spoke!.name || '', + }); + this.initialize(); + return this.innerApiCalls.updateSpoke(request, options, callback); + } + /** + * Check the status of the long running operation returned by `updateSpoke()`. + * @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 + * const decodedOperation = await checkUpdateSpokeProgress(name); + * console.log(decodedOperation.result); + * console.log(decodedOperation.done); + * console.log(decodedOperation.metadata); + */ + async checkUpdateSpokeProgress( + name: string + ): Promise< + LROperation< + protos.google.cloud.networkconnectivity.v1.Spoke, + protos.google.cloud.networkconnectivity.v1.OperationMetadata + > + > { + const request = new operationsProtos.google.longrunning.GetOperationRequest( + {name} + ); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new gax.Operation( + operation, + this.descriptors.longrunning.updateSpoke, + gax.createDefaultBackoffSettings() + ); + return decodeOperation as LROperation< + protos.google.cloud.networkconnectivity.v1.Spoke, + protos.google.cloud.networkconnectivity.v1.OperationMetadata + >; + } + deactivateSpoke( + request?: protos.google.cloud.networkconnectivity.v1.IDeactivateSpokeRequest, + options?: CallOptions + ): Promise< + [ + LROperation< + protos.google.cloud.networkconnectivity.v1.ISpoke, + protos.google.cloud.networkconnectivity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined + ] + >; + deactivateSpoke( + request: protos.google.cloud.networkconnectivity.v1.IDeactivateSpokeRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.networkconnectivity.v1.ISpoke, + protos.google.cloud.networkconnectivity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + deactivateSpoke( + request: protos.google.cloud.networkconnectivity.v1.IDeactivateSpokeRequest, + callback: Callback< + LROperation< + protos.google.cloud.networkconnectivity.v1.ISpoke, + protos.google.cloud.networkconnectivity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + /** + * Deactivates the specified spoke. Deactivating keeps the spoke information + * for future re-activation, but disconnects the Google Cloud network from + * non-Google-Cloud network. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the spoke to deactivate. + * @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. + * + * 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 + * was received. If it was, the server ignores the second request. This + * behavior prevents clients from mistakenly 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 + * const [operation] = await client.deactivateSpoke(request); + * const [response] = await operation.promise(); + */ + deactivateSpoke( + request?: protos.google.cloud.networkconnectivity.v1.IDeactivateSpokeRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.networkconnectivity.v1.ISpoke, + protos.google.cloud.networkconnectivity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.networkconnectivity.v1.ISpoke, + protos.google.cloud.networkconnectivity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): Promise< + [ + LROperation< + protos.google.cloud.networkconnectivity.v1.ISpoke, + 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'] = + gax.routingHeader.fromParams({ + name: request.name || '', + }); + this.initialize(); + return this.innerApiCalls.deactivateSpoke(request, options, callback); + } + /** + * Check the status of the long running operation returned by `deactivateSpoke()`. + * @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 + * const decodedOperation = await checkDeactivateSpokeProgress(name); + * console.log(decodedOperation.result); + * console.log(decodedOperation.done); + * console.log(decodedOperation.metadata); + */ + async checkDeactivateSpokeProgress( + name: string + ): Promise< + LROperation< + protos.google.cloud.networkconnectivity.v1.Spoke, + protos.google.cloud.networkconnectivity.v1.OperationMetadata + > + > { + const request = new operationsProtos.google.longrunning.GetOperationRequest( + {name} + ); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new gax.Operation( + operation, + this.descriptors.longrunning.deactivateSpoke, + gax.createDefaultBackoffSettings() + ); + return decodeOperation as LROperation< + protos.google.cloud.networkconnectivity.v1.Spoke, + protos.google.cloud.networkconnectivity.v1.OperationMetadata + >; + } + activateSpoke( + request?: protos.google.cloud.networkconnectivity.v1.IActivateSpokeRequest, + options?: CallOptions + ): Promise< + [ + LROperation< + protos.google.cloud.networkconnectivity.v1.ISpoke, + protos.google.cloud.networkconnectivity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined + ] + >; + activateSpoke( + request: protos.google.cloud.networkconnectivity.v1.IActivateSpokeRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.networkconnectivity.v1.ISpoke, + protos.google.cloud.networkconnectivity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + activateSpoke( + request: protos.google.cloud.networkconnectivity.v1.IActivateSpokeRequest, + callback: Callback< + LROperation< + protos.google.cloud.networkconnectivity.v1.ISpoke, + protos.google.cloud.networkconnectivity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + /** + * Activates the specified spoke. Activating reconnects the Google Cloud + * network with the non-Google-Cloud network. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the spoke to activate. + * @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. + * + * 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 + * was received. If it was, the server ignores the second request. This + * behavior prevents clients from mistakenly 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 + * const [operation] = await client.activateSpoke(request); + * const [response] = await operation.promise(); + */ + activateSpoke( + request?: protos.google.cloud.networkconnectivity.v1.IActivateSpokeRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.networkconnectivity.v1.ISpoke, + protos.google.cloud.networkconnectivity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.networkconnectivity.v1.ISpoke, + protos.google.cloud.networkconnectivity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): Promise< + [ + LROperation< + protos.google.cloud.networkconnectivity.v1.ISpoke, + 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'] = + gax.routingHeader.fromParams({ + name: request.name || '', + }); + this.initialize(); + return this.innerApiCalls.activateSpoke(request, options, callback); + } + /** + * Check the status of the long running operation returned by `activateSpoke()`. + * @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 + * const decodedOperation = await checkActivateSpokeProgress(name); + * console.log(decodedOperation.result); + * console.log(decodedOperation.done); + * console.log(decodedOperation.metadata); + */ + async checkActivateSpokeProgress( + name: string + ): Promise< + LROperation< + protos.google.cloud.networkconnectivity.v1.Spoke, + protos.google.cloud.networkconnectivity.v1.OperationMetadata + > + > { + const request = new operationsProtos.google.longrunning.GetOperationRequest( + {name} + ); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new gax.Operation( + operation, + this.descriptors.longrunning.activateSpoke, + gax.createDefaultBackoffSettings() + ); + return decodeOperation as LROperation< + protos.google.cloud.networkconnectivity.v1.Spoke, + protos.google.cloud.networkconnectivity.v1.OperationMetadata + >; + } + deleteSpoke( + request?: protos.google.cloud.networkconnectivity.v1.IDeleteSpokeRequest, + options?: CallOptions + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networkconnectivity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined + ] + >; + deleteSpoke( + request: protos.google.cloud.networkconnectivity.v1.IDeleteSpokeRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networkconnectivity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + deleteSpoke( + request: protos.google.cloud.networkconnectivity.v1.IDeleteSpokeRequest, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networkconnectivity.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + /** + * 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. + * + * 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 + * was received. If it was, the server ignores the second request. This + * behavior prevents clients from mistakenly 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 + * const [operation] = await client.deleteSpoke(request); + * const [response] = await operation.promise(); + */ + deleteSpoke( + request?: protos.google.cloud.networkconnectivity.v1.IDeleteSpokeRequest, + 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'] = + gax.routingHeader.fromParams({ + name: request.name || '', + }); + this.initialize(); + return this.innerApiCalls.deleteSpoke(request, options, callback); + } + /** + * Check the status of the long running operation returned by `deleteSpoke()`. + * @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 + * const decodedOperation = await checkDeleteSpokeProgress(name); + * console.log(decodedOperation.result); + * console.log(decodedOperation.done); + * console.log(decodedOperation.metadata); + */ + async checkDeleteSpokeProgress( + name: string + ): Promise< + LROperation< + protos.google.protobuf.Empty, + protos.google.cloud.networkconnectivity.v1.OperationMetadata + > + > { + const request = new operationsProtos.google.longrunning.GetOperationRequest( + {name} + ); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new gax.Operation( + operation, + this.descriptors.longrunning.deleteSpoke, + gax.createDefaultBackoffSettings() + ); + return decodeOperation as LROperation< + protos.google.protobuf.Empty, + protos.google.cloud.networkconnectivity.v1.OperationMetadata + >; + } + listHubs( + request?: protos.google.cloud.networkconnectivity.v1.IListHubsRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.networkconnectivity.v1.IHub[], + protos.google.cloud.networkconnectivity.v1.IListHubsRequest | null, + protos.google.cloud.networkconnectivity.v1.IListHubsResponse + ] + >; + listHubs( + request: protos.google.cloud.networkconnectivity.v1.IListHubsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.networkconnectivity.v1.IListHubsRequest, + | protos.google.cloud.networkconnectivity.v1.IListHubsResponse + | null + | undefined, + protos.google.cloud.networkconnectivity.v1.IHub + > + ): void; + listHubs( + request: protos.google.cloud.networkconnectivity.v1.IListHubsRequest, + callback: PaginationCallback< + protos.google.cloud.networkconnectivity.v1.IListHubsRequest, + | protos.google.cloud.networkconnectivity.v1.IListHubsResponse + | null + | undefined, + protos.google.cloud.networkconnectivity.v1.IHub + > + ): void; + /** + * Lists hubs in a given project. + * + * @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 + * An 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 [Hub]{@link google.cloud.networkconnectivity.v1.Hub}. + * 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 `listHubsAsync()` + * 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. + */ + listHubs( + request?: protos.google.cloud.networkconnectivity.v1.IListHubsRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< + protos.google.cloud.networkconnectivity.v1.IListHubsRequest, + | protos.google.cloud.networkconnectivity.v1.IListHubsResponse + | null + | undefined, + protos.google.cloud.networkconnectivity.v1.IHub + >, + callback?: PaginationCallback< + protos.google.cloud.networkconnectivity.v1.IListHubsRequest, + | protos.google.cloud.networkconnectivity.v1.IListHubsResponse + | null + | undefined, + protos.google.cloud.networkconnectivity.v1.IHub + > + ): Promise< + [ + protos.google.cloud.networkconnectivity.v1.IHub[], + protos.google.cloud.networkconnectivity.v1.IListHubsRequest | null, + protos.google.cloud.networkconnectivity.v1.IListHubsResponse + ] + > | 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'] = + gax.routingHeader.fromParams({ + parent: request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.listHubs(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 + * An 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 [Hub]{@link google.cloud.networkconnectivity.v1.Hub} 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 `listHubsAsync()` + * 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. + */ + listHubsStream( + request?: protos.google.cloud.networkconnectivity.v1.IListHubsRequest, + options?: CallOptions + ): Transform { + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + parent: request.parent || '', + }); + const callSettings = new gax.CallSettings(options); + this.initialize(); + return this.descriptors.page.listHubs.createStream( + this.innerApiCalls.listHubs as gax.GaxCall, + request, + callSettings + ); + } + + /** + * Equivalent to `listHubs`, 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 + * An 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 + * [Hub]{@link google.cloud.networkconnectivity.v1.Hub}. 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.listHubsAsync(request); + * for await (const response of iterable) { + * // process response + * } + */ + listHubsAsync( + request?: protos.google.cloud.networkconnectivity.v1.IListHubsRequest, + options?: CallOptions + ): AsyncIterable { + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + parent: request.parent || '', + }); + options = options || {}; + const callSettings = new gax.CallSettings(options); + this.initialize(); + return this.descriptors.page.listHubs.asyncIterate( + this.innerApiCalls['listHubs'] as GaxCall, + request as unknown as RequestType, + callSettings + ) as AsyncIterable; + } + listSpokes( + request?: protos.google.cloud.networkconnectivity.v1.IListSpokesRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.networkconnectivity.v1.ISpoke[], + protos.google.cloud.networkconnectivity.v1.IListSpokesRequest | null, + protos.google.cloud.networkconnectivity.v1.IListSpokesResponse + ] + >; + listSpokes( + request: protos.google.cloud.networkconnectivity.v1.IListSpokesRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.networkconnectivity.v1.IListSpokesRequest, + | protos.google.cloud.networkconnectivity.v1.IListSpokesResponse + | null + | undefined, + protos.google.cloud.networkconnectivity.v1.ISpoke + > + ): void; + listSpokes( + request: protos.google.cloud.networkconnectivity.v1.IListSpokesRequest, + callback: PaginationCallback< + protos.google.cloud.networkconnectivity.v1.IListSpokesRequest, + | protos.google.cloud.networkconnectivity.v1.IListSpokesResponse + | null + | undefined, + protos.google.cloud.networkconnectivity.v1.ISpoke + > + ): void; + /** + * Lists the spokes in the specified project and location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource. + * @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 + * An 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 [Spoke]{@link google.cloud.networkconnectivity.v1.Spoke}. + * 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 `listSpokesAsync()` + * 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. + */ + listSpokes( + request?: protos.google.cloud.networkconnectivity.v1.IListSpokesRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< + protos.google.cloud.networkconnectivity.v1.IListSpokesRequest, + | protos.google.cloud.networkconnectivity.v1.IListSpokesResponse + | null + | undefined, + protos.google.cloud.networkconnectivity.v1.ISpoke + >, + callback?: PaginationCallback< + protos.google.cloud.networkconnectivity.v1.IListSpokesRequest, + | protos.google.cloud.networkconnectivity.v1.IListSpokesResponse + | null + | undefined, + protos.google.cloud.networkconnectivity.v1.ISpoke + > + ): Promise< + [ + protos.google.cloud.networkconnectivity.v1.ISpoke[], + protos.google.cloud.networkconnectivity.v1.IListSpokesRequest | null, + protos.google.cloud.networkconnectivity.v1.IListSpokesResponse + ] + > | 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'] = + gax.routingHeader.fromParams({ + parent: request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.listSpokes(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. + * @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 + * An 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 [Spoke]{@link google.cloud.networkconnectivity.v1.Spoke} 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 `listSpokesAsync()` + * 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. + */ + listSpokesStream( + request?: protos.google.cloud.networkconnectivity.v1.IListSpokesRequest, + options?: CallOptions + ): Transform { + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + parent: request.parent || '', + }); + const callSettings = new gax.CallSettings(options); + this.initialize(); + return this.descriptors.page.listSpokes.createStream( + this.innerApiCalls.listSpokes as gax.GaxCall, + request, + callSettings + ); + } + + /** + * Equivalent to `listSpokes`, 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. + * @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 + * An 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 + * [Spoke]{@link google.cloud.networkconnectivity.v1.Spoke}. 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.listSpokesAsync(request); + * for await (const response of iterable) { + * // process response + * } + */ + listSpokesAsync( + request?: protos.google.cloud.networkconnectivity.v1.IListSpokesRequest, + options?: CallOptions + ): AsyncIterable { + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + parent: request.parent || '', + }); + options = options || {}; + const callSettings = new gax.CallSettings(options); + this.initialize(); + return this.descriptors.page.listSpokes.asyncIterate( + this.innerApiCalls['listSpokes'] as GaxCall, + request as unknown as RequestType, + callSettings + ) as AsyncIterable; + } + // -------------------- + // -- 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 instance resource name string. + * + * @param {string} project + * @param {string} zone + * @param {string} instance + * @returns {string} Resource name string. + */ + instancePath(project: string, zone: string, instance: string) { + return this.pathTemplates.instancePathTemplate.render({ + project: project, + zone: zone, + instance: instance, + }); + } + + /** + * Parse the project from Instance resource. + * + * @param {string} instanceName + * A fully-qualified path representing Instance resource. + * @returns {string} A string representing the project. + */ + matchProjectFromInstanceName(instanceName: string) { + return this.pathTemplates.instancePathTemplate.match(instanceName).project; + } + + /** + * Parse the zone from Instance resource. + * + * @param {string} instanceName + * A fully-qualified path representing Instance resource. + * @returns {string} A string representing the zone. + */ + matchZoneFromInstanceName(instanceName: string) { + return this.pathTemplates.instancePathTemplate.match(instanceName).zone; + } + + /** + * Parse the instance from Instance resource. + * + * @param {string} instanceName + * A fully-qualified path representing Instance resource. + * @returns {string} A string representing the instance. + */ + matchInstanceFromInstanceName(instanceName: string) { + return this.pathTemplates.instancePathTemplate.match(instanceName).instance; + } + + /** + * Return a fully-qualified interconnectAttachment resource name string. + * + * @param {string} project + * @param {string} region + * @param {string} resource_id + * @returns {string} Resource name string. + */ + interconnectAttachmentPath( + project: string, + region: string, + resourceId: string + ) { + return this.pathTemplates.interconnectAttachmentPathTemplate.render({ + project: project, + region: region, + resource_id: resourceId, + }); + } + + /** + * Parse the project from InterconnectAttachment resource. + * + * @param {string} interconnectAttachmentName + * A fully-qualified path representing InterconnectAttachment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromInterconnectAttachmentName( + interconnectAttachmentName: string + ) { + return this.pathTemplates.interconnectAttachmentPathTemplate.match( + interconnectAttachmentName + ).project; + } + + /** + * Parse the region from InterconnectAttachment resource. + * + * @param {string} interconnectAttachmentName + * A fully-qualified path representing InterconnectAttachment resource. + * @returns {string} A string representing the region. + */ + matchRegionFromInterconnectAttachmentName( + interconnectAttachmentName: string + ) { + return this.pathTemplates.interconnectAttachmentPathTemplate.match( + interconnectAttachmentName + ).region; + } + + /** + * Parse the resource_id from InterconnectAttachment resource. + * + * @param {string} interconnectAttachmentName + * A fully-qualified path representing InterconnectAttachment resource. + * @returns {string} A string representing the resource_id. + */ + matchResourceIdFromInterconnectAttachmentName( + interconnectAttachmentName: string + ) { + return this.pathTemplates.interconnectAttachmentPathTemplate.match( + interconnectAttachmentName + ).resource_id; + } + + /** + * 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 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; + } + + /** + * Return a fully-qualified vpnTunnel resource name string. + * + * @param {string} project + * @param {string} region + * @param {string} resource_id + * @returns {string} Resource name string. + */ + vpnTunnelPath(project: string, region: string, resourceId: string) { + return this.pathTemplates.vpnTunnelPathTemplate.render({ + project: project, + region: region, + resource_id: resourceId, + }); + } + + /** + * Parse the project from VpnTunnel resource. + * + * @param {string} vpnTunnelName + * A fully-qualified path representing VpnTunnel resource. + * @returns {string} A string representing the project. + */ + matchProjectFromVpnTunnelName(vpnTunnelName: string) { + return this.pathTemplates.vpnTunnelPathTemplate.match(vpnTunnelName) + .project; + } + + /** + * Parse the region from VpnTunnel resource. + * + * @param {string} vpnTunnelName + * A fully-qualified path representing VpnTunnel resource. + * @returns {string} A string representing the region. + */ + matchRegionFromVpnTunnelName(vpnTunnelName: string) { + return this.pathTemplates.vpnTunnelPathTemplate.match(vpnTunnelName).region; + } + + /** + * Parse the resource_id from VpnTunnel resource. + * + * @param {string} vpnTunnelName + * A fully-qualified path representing VpnTunnel resource. + * @returns {string} A string representing the resource_id. + */ + matchResourceIdFromVpnTunnelName(vpnTunnelName: string) { + return this.pathTemplates.vpnTunnelPathTemplate.match(vpnTunnelName) + .resource_id; + } + + /** + * 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 { + this.initialize(); + if (!this._terminated) { + return this.hubServiceStub!.then(stub => { + this._terminated = true; + stub.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/src/v1/hub_service_client_config.json b/src/v1/hub_service_client_config.json new file mode 100644 index 0000000..dfbf6f6 --- /dev/null +++ b/src/v1/hub_service_client_config.json @@ -0,0 +1,98 @@ +{ + "interfaces": { + "google.cloud.networkconnectivity.v1.HubService": { + "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": { + "ListHubs": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + }, + "GetHub": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + }, + "CreateHub": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "UpdateHub": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "DeleteHub": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "ListSpokes": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + }, + "GetSpoke": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + }, + "CreateSpoke": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "UpdateSpoke": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "DeactivateSpoke": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "ActivateSpoke": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "DeleteSpoke": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + } + } + } + } +} diff --git a/src/v1/hub_service_proto_list.json b/src/v1/hub_service_proto_list.json new file mode 100644 index 0000000..ebe50fa --- /dev/null +++ b/src/v1/hub_service_proto_list.json @@ -0,0 +1,4 @@ +[ + "../../protos/google/cloud/networkconnectivity/v1/common.proto", + "../../protos/google/cloud/networkconnectivity/v1/hub.proto" +] diff --git a/src/v1/index.ts b/src/v1/index.ts new file mode 100644 index 0000000..09b70ae --- /dev/null +++ b/src/v1/index.ts @@ -0,0 +1,19 @@ +// Copyright 2021 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. ** + +export {HubServiceClient} from './hub_service_client'; diff --git a/test/gapic_hub_service_v1.ts b/test/gapic_hub_service_v1.ts new file mode 100644 index 0000000..79e47ca --- /dev/null +++ b/test/gapic_hub_service_v1.ts @@ -0,0 +1,2962 @@ +// Copyright 2021 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 hubserviceModule from '../src'; + +import {PassThrough} from 'stream'; + +import {protobuf, LROperation, operationsProtos} from 'google-gax'; + +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.HubServiceClient', () => { + it('has servicePath', () => { + const servicePath = hubserviceModule.v1.HubServiceClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = hubserviceModule.v1.HubServiceClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = hubserviceModule.v1.HubServiceClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new hubserviceModule.v1.HubServiceClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new hubserviceModule.v1.HubServiceClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new hubserviceModule.v1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.hubServiceStub, undefined); + await client.initialize(); + assert(client.hubServiceStub); + }); + + it('has close method', () => { + const client = new hubserviceModule.v1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.close(); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new hubserviceModule.v1.HubServiceClient({ + 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 hubserviceModule.v1.HubServiceClient({ + 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('getHub', () => { + it('invokes getHub without error', async () => { + const client = new hubserviceModule.v1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networkconnectivity.v1.GetHubRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.networkconnectivity.v1.Hub() + ); + client.innerApiCalls.getHub = stubSimpleCall(expectedResponse); + const [response] = await client.getHub(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.getHub as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes getHub 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 protos.google.cloud.networkconnectivity.v1.GetHubRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.networkconnectivity.v1.Hub() + ); + client.innerApiCalls.getHub = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getHub( + request, + ( + err?: Error | null, + result?: protos.google.cloud.networkconnectivity.v1.IHub | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.getHub as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes getHub with error', async () => { + const client = new hubserviceModule.v1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networkconnectivity.v1.GetHubRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.getHub = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getHub(request), expectedError); + assert( + (client.innerApiCalls.getHub as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + }); + + describe('getSpoke', () => { + it('invokes getSpoke without error', async () => { + const client = new hubserviceModule.v1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networkconnectivity.v1.GetSpokeRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.networkconnectivity.v1.Spoke() + ); + client.innerApiCalls.getSpoke = stubSimpleCall(expectedResponse); + const [response] = await client.getSpoke(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.getSpoke as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes getSpoke 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 protos.google.cloud.networkconnectivity.v1.GetSpokeRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.networkconnectivity.v1.Spoke() + ); + client.innerApiCalls.getSpoke = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getSpoke( + request, + ( + err?: Error | null, + result?: protos.google.cloud.networkconnectivity.v1.ISpoke | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.getSpoke as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes getSpoke with error', async () => { + const client = new hubserviceModule.v1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networkconnectivity.v1.GetSpokeRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.getSpoke = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getSpoke(request), expectedError); + assert( + (client.innerApiCalls.getSpoke as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + }); + + describe('createHub', () => { + it('invokes createHub without error', async () => { + const client = new hubserviceModule.v1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networkconnectivity.v1.CreateHubRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createHub = stubLongRunningCall(expectedResponse); + const [operation] = await client.createHub(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.createHub as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes createHub 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 protos.google.cloud.networkconnectivity.v1.CreateHubRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createHub = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createHub( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.networkconnectivity.v1.IHub, + 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.IHub, + protos.google.cloud.networkconnectivity.v1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.createHub as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes createHub with call error', async () => { + const client = new hubserviceModule.v1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networkconnectivity.v1.CreateHubRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.createHub = stubLongRunningCall( + undefined, + expectedError + ); + await assert.rejects(client.createHub(request), expectedError); + assert( + (client.innerApiCalls.createHub as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes createHub with LRO error', async () => { + const client = new hubserviceModule.v1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networkconnectivity.v1.CreateHubRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.createHub = stubLongRunningCall( + undefined, + undefined, + expectedError + ); + const [operation] = await client.createHub(request); + await assert.rejects(operation.promise(), expectedError); + assert( + (client.innerApiCalls.createHub as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes checkCreateHubProgress without error', async () => { + const client = new hubserviceModule.v1.HubServiceClient({ + 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.checkCreateHubProgress( + expectedResponse.name + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkCreateHubProgress with error', async () => { + const client = new hubserviceModule.v1.HubServiceClient({ + 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.checkCreateHubProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('updateHub', () => { + it('invokes updateHub without error', async () => { + const client = new hubserviceModule.v1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networkconnectivity.v1.UpdateHubRequest() + ); + request.hub = {}; + request.hub.name = ''; + const expectedHeaderRequestParams = 'hub.name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.updateHub = stubLongRunningCall(expectedResponse); + const [operation] = await client.updateHub(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.updateHub as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes updateHub 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 protos.google.cloud.networkconnectivity.v1.UpdateHubRequest() + ); + request.hub = {}; + request.hub.name = ''; + const expectedHeaderRequestParams = 'hub.name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.updateHub = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateHub( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.networkconnectivity.v1.IHub, + 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.IHub, + protos.google.cloud.networkconnectivity.v1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.updateHub as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes updateHub with call error', async () => { + const client = new hubserviceModule.v1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networkconnectivity.v1.UpdateHubRequest() + ); + request.hub = {}; + request.hub.name = ''; + const expectedHeaderRequestParams = 'hub.name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.updateHub = stubLongRunningCall( + undefined, + expectedError + ); + await assert.rejects(client.updateHub(request), expectedError); + assert( + (client.innerApiCalls.updateHub as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes updateHub with LRO error', async () => { + const client = new hubserviceModule.v1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networkconnectivity.v1.UpdateHubRequest() + ); + request.hub = {}; + request.hub.name = ''; + const expectedHeaderRequestParams = 'hub.name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.updateHub = stubLongRunningCall( + undefined, + undefined, + expectedError + ); + const [operation] = await client.updateHub(request); + await assert.rejects(operation.promise(), expectedError); + assert( + (client.innerApiCalls.updateHub as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes checkUpdateHubProgress without error', async () => { + const client = new hubserviceModule.v1.HubServiceClient({ + 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.checkUpdateHubProgress( + expectedResponse.name + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkUpdateHubProgress with error', async () => { + const client = new hubserviceModule.v1.HubServiceClient({ + 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.checkUpdateHubProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('deleteHub', () => { + it('invokes deleteHub without error', async () => { + const client = new hubserviceModule.v1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networkconnectivity.v1.DeleteHubRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deleteHub = stubLongRunningCall(expectedResponse); + const [operation] = await client.deleteHub(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.deleteHub as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes deleteHub 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 protos.google.cloud.networkconnectivity.v1.DeleteHubRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deleteHub = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteHub( + 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); + assert( + (client.innerApiCalls.deleteHub as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes deleteHub with call error', async () => { + const client = new hubserviceModule.v1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networkconnectivity.v1.DeleteHubRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteHub = stubLongRunningCall( + undefined, + expectedError + ); + await assert.rejects(client.deleteHub(request), expectedError); + assert( + (client.innerApiCalls.deleteHub as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes deleteHub with LRO error', async () => { + const client = new hubserviceModule.v1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networkconnectivity.v1.DeleteHubRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteHub = stubLongRunningCall( + undefined, + undefined, + expectedError + ); + const [operation] = await client.deleteHub(request); + await assert.rejects(operation.promise(), expectedError); + assert( + (client.innerApiCalls.deleteHub as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes checkDeleteHubProgress without error', async () => { + const client = new hubserviceModule.v1.HubServiceClient({ + 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.checkDeleteHubProgress( + expectedResponse.name + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkDeleteHubProgress with error', async () => { + const client = new hubserviceModule.v1.HubServiceClient({ + 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.checkDeleteHubProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('createSpoke', () => { + it('invokes createSpoke without error', async () => { + const client = new hubserviceModule.v1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networkconnectivity.v1.CreateSpokeRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createSpoke = stubLongRunningCall(expectedResponse); + const [operation] = await client.createSpoke(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.createSpoke as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes createSpoke 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 protos.google.cloud.networkconnectivity.v1.CreateSpokeRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createSpoke = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createSpoke( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.networkconnectivity.v1.ISpoke, + 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.ISpoke, + protos.google.cloud.networkconnectivity.v1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.createSpoke as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes createSpoke with call error', async () => { + const client = new hubserviceModule.v1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networkconnectivity.v1.CreateSpokeRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.createSpoke = stubLongRunningCall( + undefined, + expectedError + ); + await assert.rejects(client.createSpoke(request), expectedError); + assert( + (client.innerApiCalls.createSpoke as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes createSpoke with LRO error', async () => { + const client = new hubserviceModule.v1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networkconnectivity.v1.CreateSpokeRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.createSpoke = stubLongRunningCall( + undefined, + undefined, + expectedError + ); + const [operation] = await client.createSpoke(request); + await assert.rejects(operation.promise(), expectedError); + assert( + (client.innerApiCalls.createSpoke as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes checkCreateSpokeProgress without error', async () => { + const client = new hubserviceModule.v1.HubServiceClient({ + 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.checkCreateSpokeProgress( + expectedResponse.name + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkCreateSpokeProgress with error', async () => { + const client = new hubserviceModule.v1.HubServiceClient({ + 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.checkCreateSpokeProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('updateSpoke', () => { + it('invokes updateSpoke without error', async () => { + const client = new hubserviceModule.v1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networkconnectivity.v1.UpdateSpokeRequest() + ); + request.spoke = {}; + request.spoke.name = ''; + const expectedHeaderRequestParams = 'spoke.name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.updateSpoke = stubLongRunningCall(expectedResponse); + const [operation] = await client.updateSpoke(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.updateSpoke as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes updateSpoke 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 protos.google.cloud.networkconnectivity.v1.UpdateSpokeRequest() + ); + request.spoke = {}; + request.spoke.name = ''; + const expectedHeaderRequestParams = 'spoke.name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.updateSpoke = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateSpoke( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.networkconnectivity.v1.ISpoke, + 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.ISpoke, + protos.google.cloud.networkconnectivity.v1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.updateSpoke as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes updateSpoke with call error', async () => { + const client = new hubserviceModule.v1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networkconnectivity.v1.UpdateSpokeRequest() + ); + request.spoke = {}; + request.spoke.name = ''; + const expectedHeaderRequestParams = 'spoke.name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.updateSpoke = stubLongRunningCall( + undefined, + expectedError + ); + await assert.rejects(client.updateSpoke(request), expectedError); + assert( + (client.innerApiCalls.updateSpoke as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes updateSpoke with LRO error', async () => { + const client = new hubserviceModule.v1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networkconnectivity.v1.UpdateSpokeRequest() + ); + request.spoke = {}; + request.spoke.name = ''; + const expectedHeaderRequestParams = 'spoke.name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.updateSpoke = stubLongRunningCall( + undefined, + undefined, + expectedError + ); + const [operation] = await client.updateSpoke(request); + await assert.rejects(operation.promise(), expectedError); + assert( + (client.innerApiCalls.updateSpoke as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes checkUpdateSpokeProgress without error', async () => { + const client = new hubserviceModule.v1.HubServiceClient({ + 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.checkUpdateSpokeProgress( + expectedResponse.name + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkUpdateSpokeProgress with error', async () => { + const client = new hubserviceModule.v1.HubServiceClient({ + 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.checkUpdateSpokeProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('deactivateSpoke', () => { + it('invokes deactivateSpoke without error', async () => { + const client = new hubserviceModule.v1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networkconnectivity.v1.DeactivateSpokeRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deactivateSpoke = + stubLongRunningCall(expectedResponse); + const [operation] = await client.deactivateSpoke(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.deactivateSpoke as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes deactivateSpoke 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 protos.google.cloud.networkconnectivity.v1.DeactivateSpokeRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deactivateSpoke = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deactivateSpoke( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.networkconnectivity.v1.ISpoke, + 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.ISpoke, + protos.google.cloud.networkconnectivity.v1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.deactivateSpoke as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes deactivateSpoke with call error', async () => { + const client = new hubserviceModule.v1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networkconnectivity.v1.DeactivateSpokeRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.deactivateSpoke = stubLongRunningCall( + undefined, + expectedError + ); + await assert.rejects(client.deactivateSpoke(request), expectedError); + assert( + (client.innerApiCalls.deactivateSpoke as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes deactivateSpoke with LRO error', async () => { + const client = new hubserviceModule.v1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networkconnectivity.v1.DeactivateSpokeRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.deactivateSpoke = stubLongRunningCall( + undefined, + undefined, + expectedError + ); + const [operation] = await client.deactivateSpoke(request); + await assert.rejects(operation.promise(), expectedError); + assert( + (client.innerApiCalls.deactivateSpoke as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes checkDeactivateSpokeProgress without error', async () => { + const client = new hubserviceModule.v1.HubServiceClient({ + 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.checkDeactivateSpokeProgress( + expectedResponse.name + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkDeactivateSpokeProgress with error', async () => { + const client = new hubserviceModule.v1.HubServiceClient({ + 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.checkDeactivateSpokeProgress(''), + expectedError + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('activateSpoke', () => { + it('invokes activateSpoke without error', async () => { + const client = new hubserviceModule.v1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networkconnectivity.v1.ActivateSpokeRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.activateSpoke = + stubLongRunningCall(expectedResponse); + const [operation] = await client.activateSpoke(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.activateSpoke as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes activateSpoke 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 protos.google.cloud.networkconnectivity.v1.ActivateSpokeRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.activateSpoke = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.activateSpoke( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.networkconnectivity.v1.ISpoke, + 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.ISpoke, + protos.google.cloud.networkconnectivity.v1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.activateSpoke as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes activateSpoke with call error', async () => { + const client = new hubserviceModule.v1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networkconnectivity.v1.ActivateSpokeRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.activateSpoke = stubLongRunningCall( + undefined, + expectedError + ); + await assert.rejects(client.activateSpoke(request), expectedError); + assert( + (client.innerApiCalls.activateSpoke as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes activateSpoke with LRO error', async () => { + const client = new hubserviceModule.v1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networkconnectivity.v1.ActivateSpokeRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.activateSpoke = stubLongRunningCall( + undefined, + undefined, + expectedError + ); + const [operation] = await client.activateSpoke(request); + await assert.rejects(operation.promise(), expectedError); + assert( + (client.innerApiCalls.activateSpoke as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes checkActivateSpokeProgress without error', async () => { + const client = new hubserviceModule.v1.HubServiceClient({ + 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.checkActivateSpokeProgress( + expectedResponse.name + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkActivateSpokeProgress with error', async () => { + const client = new hubserviceModule.v1.HubServiceClient({ + 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.checkActivateSpokeProgress(''), + expectedError + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('deleteSpoke', () => { + it('invokes deleteSpoke without error', async () => { + const client = new hubserviceModule.v1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networkconnectivity.v1.DeleteSpokeRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deleteSpoke = stubLongRunningCall(expectedResponse); + const [operation] = await client.deleteSpoke(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.deleteSpoke as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes deleteSpoke 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 protos.google.cloud.networkconnectivity.v1.DeleteSpokeRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deleteSpoke = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteSpoke( + 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); + assert( + (client.innerApiCalls.deleteSpoke as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes deleteSpoke with call error', async () => { + const client = new hubserviceModule.v1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networkconnectivity.v1.DeleteSpokeRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteSpoke = stubLongRunningCall( + undefined, + expectedError + ); + await assert.rejects(client.deleteSpoke(request), expectedError); + assert( + (client.innerApiCalls.deleteSpoke as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes deleteSpoke with LRO error', async () => { + const client = new hubserviceModule.v1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networkconnectivity.v1.DeleteSpokeRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteSpoke = stubLongRunningCall( + undefined, + undefined, + expectedError + ); + const [operation] = await client.deleteSpoke(request); + await assert.rejects(operation.promise(), expectedError); + assert( + (client.innerApiCalls.deleteSpoke as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes checkDeleteSpokeProgress without error', async () => { + const client = new hubserviceModule.v1.HubServiceClient({ + 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.checkDeleteSpokeProgress( + expectedResponse.name + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkDeleteSpokeProgress with error', async () => { + const client = new hubserviceModule.v1.HubServiceClient({ + 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.checkDeleteSpokeProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('listHubs', () => { + it('invokes listHubs without error', async () => { + const client = new hubserviceModule.v1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networkconnectivity.v1.ListHubsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.networkconnectivity.v1.Hub() + ), + generateSampleMessage( + new protos.google.cloud.networkconnectivity.v1.Hub() + ), + generateSampleMessage( + new protos.google.cloud.networkconnectivity.v1.Hub() + ), + ]; + client.innerApiCalls.listHubs = stubSimpleCall(expectedResponse); + const [response] = await client.listHubs(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.listHubs as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes listHubs 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 protos.google.cloud.networkconnectivity.v1.ListHubsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.networkconnectivity.v1.Hub() + ), + generateSampleMessage( + new protos.google.cloud.networkconnectivity.v1.Hub() + ), + generateSampleMessage( + new protos.google.cloud.networkconnectivity.v1.Hub() + ), + ]; + client.innerApiCalls.listHubs = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listHubs( + request, + ( + err?: Error | null, + result?: protos.google.cloud.networkconnectivity.v1.IHub[] | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.listHubs as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes listHubs with error', async () => { + const client = new hubserviceModule.v1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networkconnectivity.v1.ListHubsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.listHubs = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listHubs(request), expectedError); + assert( + (client.innerApiCalls.listHubs as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes listHubsStream without error', async () => { + const client = new hubserviceModule.v1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networkconnectivity.v1.ListHubsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.networkconnectivity.v1.Hub() + ), + generateSampleMessage( + new protos.google.cloud.networkconnectivity.v1.Hub() + ), + generateSampleMessage( + new protos.google.cloud.networkconnectivity.v1.Hub() + ), + ]; + client.descriptors.page.listHubs.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.listHubsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.networkconnectivity.v1.Hub[] = []; + stream.on( + 'data', + (response: protos.google.cloud.networkconnectivity.v1.Hub) => { + 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.listHubs.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listHubs, request) + ); + assert.strictEqual( + (client.descriptors.page.listHubs.createStream as SinonStub).getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('invokes listHubsStream with error', async () => { + const client = new hubserviceModule.v1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networkconnectivity.v1.ListHubsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedError = new Error('expected'); + client.descriptors.page.listHubs.createStream = stubPageStreamingCall( + undefined, + expectedError + ); + const stream = client.listHubsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.networkconnectivity.v1.Hub[] = []; + stream.on( + 'data', + (response: protos.google.cloud.networkconnectivity.v1.Hub) => { + responses.push(response); + } + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + (client.descriptors.page.listHubs.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listHubs, request) + ); + assert.strictEqual( + (client.descriptors.page.listHubs.createStream as SinonStub).getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listHubs without error', async () => { + const client = new hubserviceModule.v1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networkconnectivity.v1.ListHubsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.networkconnectivity.v1.Hub() + ), + generateSampleMessage( + new protos.google.cloud.networkconnectivity.v1.Hub() + ), + generateSampleMessage( + new protos.google.cloud.networkconnectivity.v1.Hub() + ), + ]; + client.descriptors.page.listHubs.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.networkconnectivity.v1.IHub[] = []; + const iterable = client.listHubsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listHubs.asyncIterate as SinonStub).getCall(0) + .args[1], + request + ); + assert.strictEqual( + (client.descriptors.page.listHubs.asyncIterate as SinonStub).getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listHubs with error', async () => { + const client = new hubserviceModule.v1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networkconnectivity.v1.ListHubsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedError = new Error('expected'); + client.descriptors.page.listHubs.asyncIterate = stubAsyncIterationCall( + undefined, + expectedError + ); + const iterable = client.listHubsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.networkconnectivity.v1.IHub[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listHubs.asyncIterate as SinonStub).getCall(0) + .args[1], + request + ); + assert.strictEqual( + (client.descriptors.page.listHubs.asyncIterate as SinonStub).getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + }); + + describe('listSpokes', () => { + it('invokes listSpokes without error', async () => { + const client = new hubserviceModule.v1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networkconnectivity.v1.ListSpokesRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.networkconnectivity.v1.Spoke() + ), + generateSampleMessage( + new protos.google.cloud.networkconnectivity.v1.Spoke() + ), + generateSampleMessage( + new protos.google.cloud.networkconnectivity.v1.Spoke() + ), + ]; + client.innerApiCalls.listSpokes = stubSimpleCall(expectedResponse); + const [response] = await client.listSpokes(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.listSpokes as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes listSpokes 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 protos.google.cloud.networkconnectivity.v1.ListSpokesRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.networkconnectivity.v1.Spoke() + ), + generateSampleMessage( + new protos.google.cloud.networkconnectivity.v1.Spoke() + ), + generateSampleMessage( + new protos.google.cloud.networkconnectivity.v1.Spoke() + ), + ]; + client.innerApiCalls.listSpokes = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listSpokes( + request, + ( + err?: Error | null, + result?: protos.google.cloud.networkconnectivity.v1.ISpoke[] | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.listSpokes as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes listSpokes with error', async () => { + const client = new hubserviceModule.v1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networkconnectivity.v1.ListSpokesRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.listSpokes = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.listSpokes(request), expectedError); + assert( + (client.innerApiCalls.listSpokes as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes listSpokesStream without error', async () => { + const client = new hubserviceModule.v1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networkconnectivity.v1.ListSpokesRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.networkconnectivity.v1.Spoke() + ), + generateSampleMessage( + new protos.google.cloud.networkconnectivity.v1.Spoke() + ), + generateSampleMessage( + new protos.google.cloud.networkconnectivity.v1.Spoke() + ), + ]; + client.descriptors.page.listSpokes.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.listSpokesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.networkconnectivity.v1.Spoke[] = + []; + stream.on( + 'data', + (response: protos.google.cloud.networkconnectivity.v1.Spoke) => { + 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.listSpokes.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listSpokes, request) + ); + assert.strictEqual( + (client.descriptors.page.listSpokes.createStream as SinonStub).getCall( + 0 + ).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('invokes listSpokesStream with error', async () => { + const client = new hubserviceModule.v1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networkconnectivity.v1.ListSpokesRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedError = new Error('expected'); + client.descriptors.page.listSpokes.createStream = stubPageStreamingCall( + undefined, + expectedError + ); + const stream = client.listSpokesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.networkconnectivity.v1.Spoke[] = + []; + stream.on( + 'data', + (response: protos.google.cloud.networkconnectivity.v1.Spoke) => { + responses.push(response); + } + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + (client.descriptors.page.listSpokes.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listSpokes, request) + ); + assert.strictEqual( + (client.descriptors.page.listSpokes.createStream as SinonStub).getCall( + 0 + ).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listSpokes without error', async () => { + const client = new hubserviceModule.v1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networkconnectivity.v1.ListSpokesRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.networkconnectivity.v1.Spoke() + ), + generateSampleMessage( + new protos.google.cloud.networkconnectivity.v1.Spoke() + ), + generateSampleMessage( + new protos.google.cloud.networkconnectivity.v1.Spoke() + ), + ]; + client.descriptors.page.listSpokes.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.networkconnectivity.v1.ISpoke[] = []; + const iterable = client.listSpokesAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listSpokes.asyncIterate as SinonStub).getCall( + 0 + ).args[1], + request + ); + assert.strictEqual( + (client.descriptors.page.listSpokes.asyncIterate as SinonStub).getCall( + 0 + ).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listSpokes with error', async () => { + const client = new hubserviceModule.v1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networkconnectivity.v1.ListSpokesRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedError = new Error('expected'); + client.descriptors.page.listSpokes.asyncIterate = stubAsyncIterationCall( + undefined, + expectedError + ); + const iterable = client.listSpokesAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.networkconnectivity.v1.ISpoke[] = + []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listSpokes.asyncIterate as SinonStub).getCall( + 0 + ).args[1], + request + ); + assert.strictEqual( + (client.descriptors.page.listSpokes.asyncIterate as SinonStub).getCall( + 0 + ).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + }); + + describe('Path templates', () => { + describe('hub', () => { + const fakePath = '/rendered/path/hub'; + const expectedParameters = { + project: 'projectValue', + hub: 'hubValue', + }; + const client = new hubserviceModule.v1.HubServiceClient({ + 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('instance', () => { + const fakePath = '/rendered/path/instance'; + const expectedParameters = { + project: 'projectValue', + zone: 'zoneValue', + instance: 'instanceValue', + }; + const client = new hubserviceModule.v1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.instancePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.instancePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('instancePath', () => { + const result = client.instancePath( + 'projectValue', + 'zoneValue', + 'instanceValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.instancePathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromInstanceName', () => { + const result = client.matchProjectFromInstanceName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.instancePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchZoneFromInstanceName', () => { + const result = client.matchZoneFromInstanceName(fakePath); + assert.strictEqual(result, 'zoneValue'); + assert( + (client.pathTemplates.instancePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchInstanceFromInstanceName', () => { + const result = client.matchInstanceFromInstanceName(fakePath); + assert.strictEqual(result, 'instanceValue'); + assert( + (client.pathTemplates.instancePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('interconnectAttachment', () => { + const fakePath = '/rendered/path/interconnectAttachment'; + const expectedParameters = { + project: 'projectValue', + region: 'regionValue', + resource_id: 'resourceIdValue', + }; + const client = new hubserviceModule.v1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.interconnectAttachmentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.interconnectAttachmentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('interconnectAttachmentPath', () => { + const result = client.interconnectAttachmentPath( + 'projectValue', + 'regionValue', + 'resourceIdValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.interconnectAttachmentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromInterconnectAttachmentName', () => { + const result = + client.matchProjectFromInterconnectAttachmentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.interconnectAttachmentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchRegionFromInterconnectAttachmentName', () => { + const result = + client.matchRegionFromInterconnectAttachmentName(fakePath); + assert.strictEqual(result, 'regionValue'); + assert( + ( + client.pathTemplates.interconnectAttachmentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchResourceIdFromInterconnectAttachmentName', () => { + const result = + client.matchResourceIdFromInterconnectAttachmentName(fakePath); + assert.strictEqual(result, 'resourceIdValue'); + assert( + ( + client.pathTemplates.interconnectAttachmentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('location', () => { + const fakePath = '/rendered/path/location'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + }; + const client = new hubserviceModule.v1.HubServiceClient({ + 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('spoke', () => { + const fakePath = '/rendered/path/spoke'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + spoke: 'spokeValue', + }; + const client = new hubserviceModule.v1.HubServiceClient({ + 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) + ); + }); + }); + + describe('vpnTunnel', () => { + const fakePath = '/rendered/path/vpnTunnel'; + const expectedParameters = { + project: 'projectValue', + region: 'regionValue', + resource_id: 'resourceIdValue', + }; + const client = new hubserviceModule.v1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.vpnTunnelPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.vpnTunnelPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('vpnTunnelPath', () => { + const result = client.vpnTunnelPath( + 'projectValue', + 'regionValue', + 'resourceIdValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.vpnTunnelPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromVpnTunnelName', () => { + const result = client.matchProjectFromVpnTunnelName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.vpnTunnelPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchRegionFromVpnTunnelName', () => { + const result = client.matchRegionFromVpnTunnelName(fakePath); + assert.strictEqual(result, 'regionValue'); + assert( + (client.pathTemplates.vpnTunnelPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchResourceIdFromVpnTunnelName', () => { + const result = client.matchResourceIdFromVpnTunnelName(fakePath); + assert.strictEqual(result, 'resourceIdValue'); + assert( + (client.pathTemplates.vpnTunnelPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + }); +});