diff --git a/packages/google-cloud-networkmanagement/README.md b/packages/google-cloud-networkmanagement/README.md index de7462317bc..06da7889ccc 100644 --- a/packages/google-cloud-networkmanagement/README.md +++ b/packages/google-cloud-networkmanagement/README.md @@ -93,6 +93,11 @@ Samples are in the [`samples/`](https://github.com/googleapis/google-cloud-node/ | Reachability_service.list_connectivity_tests | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-networkmanagement/samples/generated/v1/reachability_service.list_connectivity_tests.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-networkmanagement/samples/generated/v1/reachability_service.list_connectivity_tests.js,packages/google-cloud-networkmanagement/samples/README.md) | | Reachability_service.rerun_connectivity_test | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-networkmanagement/samples/generated/v1/reachability_service.rerun_connectivity_test.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-networkmanagement/samples/generated/v1/reachability_service.rerun_connectivity_test.js,packages/google-cloud-networkmanagement/samples/README.md) | | Reachability_service.update_connectivity_test | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-networkmanagement/samples/generated/v1/reachability_service.update_connectivity_test.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-networkmanagement/samples/generated/v1/reachability_service.update_connectivity_test.js,packages/google-cloud-networkmanagement/samples/README.md) | +| Vpc_flow_logs_service.create_vpc_flow_logs_config | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-networkmanagement/samples/generated/v1/vpc_flow_logs_service.create_vpc_flow_logs_config.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-networkmanagement/samples/generated/v1/vpc_flow_logs_service.create_vpc_flow_logs_config.js,packages/google-cloud-networkmanagement/samples/README.md) | +| Vpc_flow_logs_service.delete_vpc_flow_logs_config | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-networkmanagement/samples/generated/v1/vpc_flow_logs_service.delete_vpc_flow_logs_config.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-networkmanagement/samples/generated/v1/vpc_flow_logs_service.delete_vpc_flow_logs_config.js,packages/google-cloud-networkmanagement/samples/README.md) | +| Vpc_flow_logs_service.get_vpc_flow_logs_config | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-networkmanagement/samples/generated/v1/vpc_flow_logs_service.get_vpc_flow_logs_config.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-networkmanagement/samples/generated/v1/vpc_flow_logs_service.get_vpc_flow_logs_config.js,packages/google-cloud-networkmanagement/samples/README.md) | +| Vpc_flow_logs_service.list_vpc_flow_logs_configs | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-networkmanagement/samples/generated/v1/vpc_flow_logs_service.list_vpc_flow_logs_configs.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-networkmanagement/samples/generated/v1/vpc_flow_logs_service.list_vpc_flow_logs_configs.js,packages/google-cloud-networkmanagement/samples/README.md) | +| Vpc_flow_logs_service.update_vpc_flow_logs_config | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-networkmanagement/samples/generated/v1/vpc_flow_logs_service.update_vpc_flow_logs_config.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-networkmanagement/samples/generated/v1/vpc_flow_logs_service.update_vpc_flow_logs_config.js,packages/google-cloud-networkmanagement/samples/README.md) | | Reachability_service.create_connectivity_test | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-networkmanagement/samples/generated/v1beta1/reachability_service.create_connectivity_test.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-networkmanagement/samples/generated/v1beta1/reachability_service.create_connectivity_test.js,packages/google-cloud-networkmanagement/samples/README.md) | | Reachability_service.delete_connectivity_test | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-networkmanagement/samples/generated/v1beta1/reachability_service.delete_connectivity_test.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-networkmanagement/samples/generated/v1beta1/reachability_service.delete_connectivity_test.js,packages/google-cloud-networkmanagement/samples/README.md) | | Reachability_service.get_connectivity_test | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-networkmanagement/samples/generated/v1beta1/reachability_service.get_connectivity_test.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-networkmanagement/samples/generated/v1beta1/reachability_service.get_connectivity_test.js,packages/google-cloud-networkmanagement/samples/README.md) | diff --git a/packages/google-cloud-networkmanagement/protos/google/cloud/networkmanagement/v1/vpc_flow_logs.proto b/packages/google-cloud-networkmanagement/protos/google/cloud/networkmanagement/v1/vpc_flow_logs.proto new file mode 100644 index 00000000000..b1e60bfff0d --- /dev/null +++ b/packages/google-cloud-networkmanagement/protos/google/cloud/networkmanagement/v1/vpc_flow_logs.proto @@ -0,0 +1,231 @@ +// Copyright 2024 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.networkmanagement.v1; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/cloud/networkmanagement/v1/reachability.proto"; +import "google/cloud/networkmanagement/v1/vpc_flow_logs_config.proto"; +import "google/longrunning/operations.proto"; +import "google/protobuf/empty.proto"; +import "google/protobuf/field_mask.proto"; + +option csharp_namespace = "Google.Cloud.NetworkManagement.V1"; +option go_package = "cloud.google.com/go/networkmanagement/apiv1/networkmanagementpb;networkmanagementpb"; +option java_multiple_files = true; +option java_outer_classname = "VpcFlowLogsProto"; +option java_package = "com.google.cloud.networkmanagement.v1"; +option php_namespace = "Google\\Cloud\\NetworkManagement\\V1"; +option ruby_package = "Google::Cloud::NetworkManagement::V1"; + +// The VPC Flow Logs service in the Google Cloud Network Management API provides +// configurations that generate Flow Logs. The service and the configuration +// resources created using this service are global. +service VpcFlowLogsService { + option (google.api.default_host) = "networkmanagement.googleapis.com"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-platform"; + + // Lists all `VpcFlowLogsConfigs` in a given project. + rpc ListVpcFlowLogsConfigs(ListVpcFlowLogsConfigsRequest) + returns (ListVpcFlowLogsConfigsResponse) { + option (google.api.http) = { + get: "/v1/{parent=projects/*/locations/*}/vpcFlowLogsConfigs" + }; + option (google.api.method_signature) = "parent"; + } + + // Gets the details of a specific `VpcFlowLogsConfig`. + rpc GetVpcFlowLogsConfig(GetVpcFlowLogsConfigRequest) + returns (VpcFlowLogsConfig) { + option (google.api.http) = { + get: "/v1/{name=projects/*/locations/*/vpcFlowLogsConfigs/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Creates a new `VpcFlowLogsConfig`. + // If a configuration with the exact same settings already exists (even if the + // ID is different), the creation fails. + // Notes: + // + // 1. Creating a configuration with state=DISABLED will fail + // 2. The following fields are not considered as `settings` for the purpose + // of the check mentioned above, therefore - creating another configuration + // with the same fields but different values for the following fields will + // fail as well: + // * name + // * create_time + // * update_time + // * labels + // * description + rpc CreateVpcFlowLogsConfig(CreateVpcFlowLogsConfigRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1/{parent=projects/*/locations/*}/vpcFlowLogsConfigs" + body: "vpc_flow_logs_config" + }; + option (google.api.method_signature) = + "parent,vpc_flow_logs_config,vpc_flow_logs_config_id"; + option (google.longrunning.operation_info) = { + response_type: "VpcFlowLogsConfig" + metadata_type: "google.cloud.networkmanagement.v1.OperationMetadata" + }; + } + + // Updates an existing `VpcFlowLogsConfig`. + // If a configuration with the exact same settings already exists (even if the + // ID is different), the creation fails. + // Notes: + // + // 1. Updating a configuration with state=DISABLED will fail. + // 2. The following fields are not considered as `settings` for the purpose + // of the check mentioned above, therefore - updating another configuration + // with the same fields but different values for the following fields will + // fail as well: + // * name + // * create_time + // * update_time + // * labels + // * description + rpc UpdateVpcFlowLogsConfig(UpdateVpcFlowLogsConfigRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + patch: "/v1/{vpc_flow_logs_config.name=projects/*/locations/*/vpcFlowLogsConfigs/*}" + body: "vpc_flow_logs_config" + }; + option (google.api.method_signature) = "vpc_flow_logs_config,update_mask"; + option (google.longrunning.operation_info) = { + response_type: "VpcFlowLogsConfig" + metadata_type: "google.cloud.networkmanagement.v1.OperationMetadata" + }; + } + + // Deletes a specific `VpcFlowLogsConfig`. + rpc DeleteVpcFlowLogsConfig(DeleteVpcFlowLogsConfigRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + delete: "/v1/{name=projects/*/locations/*/vpcFlowLogsConfigs/*}" + }; + option (google.api.method_signature) = "name"; + option (google.longrunning.operation_info) = { + response_type: "google.protobuf.Empty" + metadata_type: "google.cloud.networkmanagement.v1.OperationMetadata" + }; + } +} + +// Request for the `ListVpcFlowLogsConfigs` method. +message ListVpcFlowLogsConfigsRequest { + // Required. The parent resource of the VpcFlowLogsConfig: + // `projects/{project_id}/locations/global` + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "networkmanagement.googleapis.com/VpcFlowLogsConfig" + } + ]; + + // Optional. Number of `VpcFlowLogsConfigs` to return. + int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Page token from an earlier query, as returned in + // `next_page_token`. + string page_token = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Lists the `VpcFlowLogsConfigs` that match the filter expression. + // A filter expression must use the supported [CEL logic operators] + // (https://cloud.google.com/vpc/docs/about-flow-logs-records#supported_cel_logic_operators). + string filter = 4 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Field to use to sort the list. + string order_by = 5 [(google.api.field_behavior) = OPTIONAL]; +} + +// Response for the `ListVpcFlowLogsConfigs` method. +message ListVpcFlowLogsConfigsResponse { + // List of VPC Flow Log configurations. + repeated VpcFlowLogsConfig vpc_flow_logs_configs = 1; + + // Page token to fetch the next set of configurations. + string next_page_token = 2; + + // Locations that could not be reached (when querying all locations with `-`). + repeated string unreachable = 3; +} + +// Request for the `GetVpcFlowLogsConfig` method. +message GetVpcFlowLogsConfigRequest { + // Required. `VpcFlowLogsConfig` resource name using the form: + // `projects/{project_id}/locations/global/vpcFlowLogsConfigs/{vpc_flow_logs_config}` + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "networkmanagement.googleapis.com/VpcFlowLogsConfig" + } + ]; +} + +// Request for the `CreateVpcFlowLogsConfig` method. +message CreateVpcFlowLogsConfigRequest { + // Required. The parent resource of the VPC Flow Logs configuration to create: + // `projects/{project_id}/locations/global` + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "networkmanagement.googleapis.com/VpcFlowLogsConfig" + } + ]; + + // Required. ID of the `VpcFlowLogsConfig`. + string vpc_flow_logs_config_id = 2 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "networkmanagement.googleapis.com/VpcFlowLogsConfig" + } + ]; + + // Required. A `VpcFlowLogsConfig` resource + VpcFlowLogsConfig vpc_flow_logs_config = 3 + [(google.api.field_behavior) = REQUIRED]; +} + +// Request for the `UpdateVpcFlowLogsConfig` method. +message UpdateVpcFlowLogsConfigRequest { + // Required. Mask of fields to update. At least one path must be supplied in + // this field. + google.protobuf.FieldMask update_mask = 1 + [(google.api.field_behavior) = REQUIRED]; + + // Required. Only fields specified in update_mask are updated. + VpcFlowLogsConfig vpc_flow_logs_config = 2 + [(google.api.field_behavior) = REQUIRED]; +} + +// Request for the `DeleteVpcFlowLogsConfig` method. +message DeleteVpcFlowLogsConfigRequest { + // Required. `VpcFlowLogsConfig` resource name using the form: + // `projects/{project_id}/locations/global/vpcFlowLogsConfigs/{vpc_flow_logs_config}` + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "networkmanagement.googleapis.com/VpcFlowLogsConfig" + } + ]; +} diff --git a/packages/google-cloud-networkmanagement/protos/google/cloud/networkmanagement/v1/vpc_flow_logs_config.proto b/packages/google-cloud-networkmanagement/protos/google/cloud/networkmanagement/v1/vpc_flow_logs_config.proto new file mode 100644 index 00000000000..77cc33c26c2 --- /dev/null +++ b/packages/google-cloud-networkmanagement/protos/google/cloud/networkmanagement/v1/vpc_flow_logs_config.proto @@ -0,0 +1,170 @@ +// Copyright 2024 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.networkmanagement.v1; + +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/protobuf/timestamp.proto"; + +option csharp_namespace = "Google.Cloud.NetworkManagement.V1"; +option go_package = "cloud.google.com/go/networkmanagement/apiv1/networkmanagementpb;networkmanagementpb"; +option java_multiple_files = true; +option java_outer_classname = "VpcFlowLogsConfigProto"; +option java_package = "com.google.cloud.networkmanagement.v1"; +option php_namespace = "Google\\Cloud\\NetworkManagement\\V1"; +option ruby_package = "Google::Cloud::NetworkManagement::V1"; + +// A configuration to generate VPC Flow Logs. +message VpcFlowLogsConfig { + option (google.api.resource) = { + type: "networkmanagement.googleapis.com/VpcFlowLogsConfig" + pattern: "projects/{project}/locations/{location}/vpcFlowLogsConfigs/{vpc_flow_logs_config}" + plural: "vpcFlowLogsConfigs" + singular: "vpcFlowLogsConfig" + }; + + // Determines whether this configuration will be generating logs. + // Setting state=DISABLED will pause the log generation for this config. + enum State { + // If not specified, will default to ENABLED. + STATE_UNSPECIFIED = 0; + + // When ENABLED, this configuration will generate logs. + ENABLED = 1; + + // When DISABLED, this configuration will not generate logs. + DISABLED = 2; + } + + // Toggles the aggregation interval for collecting flow logs by 5-tuple. + enum AggregationInterval { + // If not specified, will default to INTERVAL_5_SEC. + AGGREGATION_INTERVAL_UNSPECIFIED = 0; + + // Aggregate logs in 5s intervals. + INTERVAL_5_SEC = 1; + + // Aggregate logs in 30s intervals. + INTERVAL_30_SEC = 2; + + // Aggregate logs in 1m intervals. + INTERVAL_1_MIN = 3; + + // Aggregate logs in 5m intervals. + INTERVAL_5_MIN = 4; + + // Aggregate logs in 10m intervals. + INTERVAL_10_MIN = 5; + + // Aggregate logs in 15m intervals. + INTERVAL_15_MIN = 6; + } + + // Configures which log fields would be included. + enum Metadata { + // If not specified, will default to INCLUDE_ALL_METADATA. + METADATA_UNSPECIFIED = 0; + + // Include all metadata fields. + INCLUDE_ALL_METADATA = 1; + + // Exclude all metadata fields. + EXCLUDE_ALL_METADATA = 2; + + // Include only custom fields (specified in metadata_fields). + CUSTOM_METADATA = 3; + } + + // Optional states of the target resource that are used as part of the + // diagnostic bit. + enum TargetResourceState { + // Unspecified target resource state. + TARGET_RESOURCE_STATE_UNSPECIFIED = 0; + + // Indicates that the target resource exists. + TARGET_RESOURCE_EXISTS = 1; + + // Indicates that the target resource does not exist. + TARGET_RESOURCE_DOES_NOT_EXIST = 2; + } + + // Identifier. Unique name of the configuration using the form: + // `projects/{project_id}/locations/global/vpcFlowLogsConfigs/{vpc_flow_logs_config_id}` + string name = 1 [(google.api.field_behavior) = IDENTIFIER]; + + // Optional. The user-supplied description of the VPC Flow Logs configuration. + // Maximum of 512 characters. + optional string description = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The state of the VPC Flow Log configuration. Default value is + // ENABLED. When creating a new configuration, it must be enabled. + optional State state = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The aggregation interval for the logs. Default value is + // INTERVAL_5_SEC. + optional AggregationInterval aggregation_interval = 4 + [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The value of the field must be in (0, 1]. The sampling rate of + // VPC Flow Logs where 1.0 means all collected logs are reported. Setting the + // sampling rate to 0.0 is not allowed. If you want to disable VPC Flow Logs, + // use the state field instead. Default value is 1.0. + optional float flow_sampling = 5 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Configures whether all, none or a subset of metadata fields + // should be added to the reported VPC flow logs. Default value is + // INCLUDE_ALL_METADATA. + optional Metadata metadata = 6 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Custom metadata fields to include in the reported VPC flow logs. + // Can only be specified if "metadata" was set to CUSTOM_METADATA. + repeated string metadata_fields = 7 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Export filter used to define which VPC Flow Logs should be + // logged. + optional string filter_expr = 8 [(google.api.field_behavior) = OPTIONAL]; + + // Output only. A diagnostic bit - describes the state of the configured + // target resource for diagnostic purposes. + optional TargetResourceState target_resource_state = 12 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Reference to the resource of the config scope. That is, the scope from + // which traffic is logged. The target resource must belong to the same + // project as the configuration. + oneof target_resource { + // Traffic will be logged from the Interconnect Attachment. + // Format: + // projects/{project_id}/regions/{region}/interconnectAttachments/{name} + string interconnect_attachment = 102; + + // Traffic will be logged from the VPN Tunnel. + // Format: projects/{project_id}/regions/{region}/vpnTunnels/{name} + string vpn_tunnel = 103; + } + + // Optional. Resource labels to represent user-provided metadata. + map labels = 11 [(google.api.field_behavior) = OPTIONAL]; + + // Output only. The time the config was created. + google.protobuf.Timestamp create_time = 9 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The time the config was updated. + google.protobuf.Timestamp update_time = 10 + [(google.api.field_behavior) = OUTPUT_ONLY]; +} diff --git a/packages/google-cloud-networkmanagement/protos/protos.d.ts b/packages/google-cloud-networkmanagement/protos/protos.d.ts index 9f961310046..543fd51e329 100644 --- a/packages/google-cloud-networkmanagement/protos/protos.d.ts +++ b/packages/google-cloud-networkmanagement/protos/protos.d.ts @@ -6731,6 +6731,1006 @@ export namespace google { */ public static getTypeUrl(typeUrlPrefix?: string): string; } + + /** Represents a VpcFlowLogsService */ + class VpcFlowLogsService extends $protobuf.rpc.Service { + + /** + * Constructs a new VpcFlowLogsService 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 VpcFlowLogsService 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): VpcFlowLogsService; + + /** + * Calls ListVpcFlowLogsConfigs. + * @param request ListVpcFlowLogsConfigsRequest message or plain object + * @param callback Node-style callback called with the error, if any, and ListVpcFlowLogsConfigsResponse + */ + public listVpcFlowLogsConfigs(request: google.cloud.networkmanagement.v1.IListVpcFlowLogsConfigsRequest, callback: google.cloud.networkmanagement.v1.VpcFlowLogsService.ListVpcFlowLogsConfigsCallback): void; + + /** + * Calls ListVpcFlowLogsConfigs. + * @param request ListVpcFlowLogsConfigsRequest message or plain object + * @returns Promise + */ + public listVpcFlowLogsConfigs(request: google.cloud.networkmanagement.v1.IListVpcFlowLogsConfigsRequest): Promise; + + /** + * Calls GetVpcFlowLogsConfig. + * @param request GetVpcFlowLogsConfigRequest message or plain object + * @param callback Node-style callback called with the error, if any, and VpcFlowLogsConfig + */ + public getVpcFlowLogsConfig(request: google.cloud.networkmanagement.v1.IGetVpcFlowLogsConfigRequest, callback: google.cloud.networkmanagement.v1.VpcFlowLogsService.GetVpcFlowLogsConfigCallback): void; + + /** + * Calls GetVpcFlowLogsConfig. + * @param request GetVpcFlowLogsConfigRequest message or plain object + * @returns Promise + */ + public getVpcFlowLogsConfig(request: google.cloud.networkmanagement.v1.IGetVpcFlowLogsConfigRequest): Promise; + + /** + * Calls CreateVpcFlowLogsConfig. + * @param request CreateVpcFlowLogsConfigRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public createVpcFlowLogsConfig(request: google.cloud.networkmanagement.v1.ICreateVpcFlowLogsConfigRequest, callback: google.cloud.networkmanagement.v1.VpcFlowLogsService.CreateVpcFlowLogsConfigCallback): void; + + /** + * Calls CreateVpcFlowLogsConfig. + * @param request CreateVpcFlowLogsConfigRequest message or plain object + * @returns Promise + */ + public createVpcFlowLogsConfig(request: google.cloud.networkmanagement.v1.ICreateVpcFlowLogsConfigRequest): Promise; + + /** + * Calls UpdateVpcFlowLogsConfig. + * @param request UpdateVpcFlowLogsConfigRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public updateVpcFlowLogsConfig(request: google.cloud.networkmanagement.v1.IUpdateVpcFlowLogsConfigRequest, callback: google.cloud.networkmanagement.v1.VpcFlowLogsService.UpdateVpcFlowLogsConfigCallback): void; + + /** + * Calls UpdateVpcFlowLogsConfig. + * @param request UpdateVpcFlowLogsConfigRequest message or plain object + * @returns Promise + */ + public updateVpcFlowLogsConfig(request: google.cloud.networkmanagement.v1.IUpdateVpcFlowLogsConfigRequest): Promise; + + /** + * Calls DeleteVpcFlowLogsConfig. + * @param request DeleteVpcFlowLogsConfigRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public deleteVpcFlowLogsConfig(request: google.cloud.networkmanagement.v1.IDeleteVpcFlowLogsConfigRequest, callback: google.cloud.networkmanagement.v1.VpcFlowLogsService.DeleteVpcFlowLogsConfigCallback): void; + + /** + * Calls DeleteVpcFlowLogsConfig. + * @param request DeleteVpcFlowLogsConfigRequest message or plain object + * @returns Promise + */ + public deleteVpcFlowLogsConfig(request: google.cloud.networkmanagement.v1.IDeleteVpcFlowLogsConfigRequest): Promise; + } + + namespace VpcFlowLogsService { + + /** + * Callback as used by {@link google.cloud.networkmanagement.v1.VpcFlowLogsService|listVpcFlowLogsConfigs}. + * @param error Error, if any + * @param [response] ListVpcFlowLogsConfigsResponse + */ + type ListVpcFlowLogsConfigsCallback = (error: (Error|null), response?: google.cloud.networkmanagement.v1.ListVpcFlowLogsConfigsResponse) => void; + + /** + * Callback as used by {@link google.cloud.networkmanagement.v1.VpcFlowLogsService|getVpcFlowLogsConfig}. + * @param error Error, if any + * @param [response] VpcFlowLogsConfig + */ + type GetVpcFlowLogsConfigCallback = (error: (Error|null), response?: google.cloud.networkmanagement.v1.VpcFlowLogsConfig) => void; + + /** + * Callback as used by {@link google.cloud.networkmanagement.v1.VpcFlowLogsService|createVpcFlowLogsConfig}. + * @param error Error, if any + * @param [response] Operation + */ + type CreateVpcFlowLogsConfigCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + + /** + * Callback as used by {@link google.cloud.networkmanagement.v1.VpcFlowLogsService|updateVpcFlowLogsConfig}. + * @param error Error, if any + * @param [response] Operation + */ + type UpdateVpcFlowLogsConfigCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + + /** + * Callback as used by {@link google.cloud.networkmanagement.v1.VpcFlowLogsService|deleteVpcFlowLogsConfig}. + * @param error Error, if any + * @param [response] Operation + */ + type DeleteVpcFlowLogsConfigCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + } + + /** Properties of a ListVpcFlowLogsConfigsRequest. */ + interface IListVpcFlowLogsConfigsRequest { + + /** ListVpcFlowLogsConfigsRequest parent */ + parent?: (string|null); + + /** ListVpcFlowLogsConfigsRequest pageSize */ + pageSize?: (number|null); + + /** ListVpcFlowLogsConfigsRequest pageToken */ + pageToken?: (string|null); + + /** ListVpcFlowLogsConfigsRequest filter */ + filter?: (string|null); + + /** ListVpcFlowLogsConfigsRequest orderBy */ + orderBy?: (string|null); + } + + /** Represents a ListVpcFlowLogsConfigsRequest. */ + class ListVpcFlowLogsConfigsRequest implements IListVpcFlowLogsConfigsRequest { + + /** + * Constructs a new ListVpcFlowLogsConfigsRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.networkmanagement.v1.IListVpcFlowLogsConfigsRequest); + + /** ListVpcFlowLogsConfigsRequest parent. */ + public parent: string; + + /** ListVpcFlowLogsConfigsRequest pageSize. */ + public pageSize: number; + + /** ListVpcFlowLogsConfigsRequest pageToken. */ + public pageToken: string; + + /** ListVpcFlowLogsConfigsRequest filter. */ + public filter: string; + + /** ListVpcFlowLogsConfigsRequest orderBy. */ + public orderBy: string; + + /** + * Creates a new ListVpcFlowLogsConfigsRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns ListVpcFlowLogsConfigsRequest instance + */ + public static create(properties?: google.cloud.networkmanagement.v1.IListVpcFlowLogsConfigsRequest): google.cloud.networkmanagement.v1.ListVpcFlowLogsConfigsRequest; + + /** + * Encodes the specified ListVpcFlowLogsConfigsRequest message. Does not implicitly {@link google.cloud.networkmanagement.v1.ListVpcFlowLogsConfigsRequest.verify|verify} messages. + * @param message ListVpcFlowLogsConfigsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.networkmanagement.v1.IListVpcFlowLogsConfigsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListVpcFlowLogsConfigsRequest message, length delimited. Does not implicitly {@link google.cloud.networkmanagement.v1.ListVpcFlowLogsConfigsRequest.verify|verify} messages. + * @param message ListVpcFlowLogsConfigsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.networkmanagement.v1.IListVpcFlowLogsConfigsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListVpcFlowLogsConfigsRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListVpcFlowLogsConfigsRequest + * @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.networkmanagement.v1.ListVpcFlowLogsConfigsRequest; + + /** + * Decodes a ListVpcFlowLogsConfigsRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListVpcFlowLogsConfigsRequest + * @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.networkmanagement.v1.ListVpcFlowLogsConfigsRequest; + + /** + * Verifies a ListVpcFlowLogsConfigsRequest 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 ListVpcFlowLogsConfigsRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListVpcFlowLogsConfigsRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.networkmanagement.v1.ListVpcFlowLogsConfigsRequest; + + /** + * Creates a plain object from a ListVpcFlowLogsConfigsRequest message. Also converts values to other types if specified. + * @param message ListVpcFlowLogsConfigsRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.networkmanagement.v1.ListVpcFlowLogsConfigsRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListVpcFlowLogsConfigsRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ListVpcFlowLogsConfigsRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a ListVpcFlowLogsConfigsResponse. */ + interface IListVpcFlowLogsConfigsResponse { + + /** ListVpcFlowLogsConfigsResponse vpcFlowLogsConfigs */ + vpcFlowLogsConfigs?: (google.cloud.networkmanagement.v1.IVpcFlowLogsConfig[]|null); + + /** ListVpcFlowLogsConfigsResponse nextPageToken */ + nextPageToken?: (string|null); + + /** ListVpcFlowLogsConfigsResponse unreachable */ + unreachable?: (string[]|null); + } + + /** Represents a ListVpcFlowLogsConfigsResponse. */ + class ListVpcFlowLogsConfigsResponse implements IListVpcFlowLogsConfigsResponse { + + /** + * Constructs a new ListVpcFlowLogsConfigsResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.networkmanagement.v1.IListVpcFlowLogsConfigsResponse); + + /** ListVpcFlowLogsConfigsResponse vpcFlowLogsConfigs. */ + public vpcFlowLogsConfigs: google.cloud.networkmanagement.v1.IVpcFlowLogsConfig[]; + + /** ListVpcFlowLogsConfigsResponse nextPageToken. */ + public nextPageToken: string; + + /** ListVpcFlowLogsConfigsResponse unreachable. */ + public unreachable: string[]; + + /** + * Creates a new ListVpcFlowLogsConfigsResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns ListVpcFlowLogsConfigsResponse instance + */ + public static create(properties?: google.cloud.networkmanagement.v1.IListVpcFlowLogsConfigsResponse): google.cloud.networkmanagement.v1.ListVpcFlowLogsConfigsResponse; + + /** + * Encodes the specified ListVpcFlowLogsConfigsResponse message. Does not implicitly {@link google.cloud.networkmanagement.v1.ListVpcFlowLogsConfigsResponse.verify|verify} messages. + * @param message ListVpcFlowLogsConfigsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.networkmanagement.v1.IListVpcFlowLogsConfigsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListVpcFlowLogsConfigsResponse message, length delimited. Does not implicitly {@link google.cloud.networkmanagement.v1.ListVpcFlowLogsConfigsResponse.verify|verify} messages. + * @param message ListVpcFlowLogsConfigsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.networkmanagement.v1.IListVpcFlowLogsConfigsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListVpcFlowLogsConfigsResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListVpcFlowLogsConfigsResponse + * @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.networkmanagement.v1.ListVpcFlowLogsConfigsResponse; + + /** + * Decodes a ListVpcFlowLogsConfigsResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListVpcFlowLogsConfigsResponse + * @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.networkmanagement.v1.ListVpcFlowLogsConfigsResponse; + + /** + * Verifies a ListVpcFlowLogsConfigsResponse 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 ListVpcFlowLogsConfigsResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListVpcFlowLogsConfigsResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.networkmanagement.v1.ListVpcFlowLogsConfigsResponse; + + /** + * Creates a plain object from a ListVpcFlowLogsConfigsResponse message. Also converts values to other types if specified. + * @param message ListVpcFlowLogsConfigsResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.networkmanagement.v1.ListVpcFlowLogsConfigsResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListVpcFlowLogsConfigsResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ListVpcFlowLogsConfigsResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a GetVpcFlowLogsConfigRequest. */ + interface IGetVpcFlowLogsConfigRequest { + + /** GetVpcFlowLogsConfigRequest name */ + name?: (string|null); + } + + /** Represents a GetVpcFlowLogsConfigRequest. */ + class GetVpcFlowLogsConfigRequest implements IGetVpcFlowLogsConfigRequest { + + /** + * Constructs a new GetVpcFlowLogsConfigRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.networkmanagement.v1.IGetVpcFlowLogsConfigRequest); + + /** GetVpcFlowLogsConfigRequest name. */ + public name: string; + + /** + * Creates a new GetVpcFlowLogsConfigRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns GetVpcFlowLogsConfigRequest instance + */ + public static create(properties?: google.cloud.networkmanagement.v1.IGetVpcFlowLogsConfigRequest): google.cloud.networkmanagement.v1.GetVpcFlowLogsConfigRequest; + + /** + * Encodes the specified GetVpcFlowLogsConfigRequest message. Does not implicitly {@link google.cloud.networkmanagement.v1.GetVpcFlowLogsConfigRequest.verify|verify} messages. + * @param message GetVpcFlowLogsConfigRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.networkmanagement.v1.IGetVpcFlowLogsConfigRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified GetVpcFlowLogsConfigRequest message, length delimited. Does not implicitly {@link google.cloud.networkmanagement.v1.GetVpcFlowLogsConfigRequest.verify|verify} messages. + * @param message GetVpcFlowLogsConfigRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.networkmanagement.v1.IGetVpcFlowLogsConfigRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a GetVpcFlowLogsConfigRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns GetVpcFlowLogsConfigRequest + * @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.networkmanagement.v1.GetVpcFlowLogsConfigRequest; + + /** + * Decodes a GetVpcFlowLogsConfigRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns GetVpcFlowLogsConfigRequest + * @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.networkmanagement.v1.GetVpcFlowLogsConfigRequest; + + /** + * Verifies a GetVpcFlowLogsConfigRequest 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 GetVpcFlowLogsConfigRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns GetVpcFlowLogsConfigRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.networkmanagement.v1.GetVpcFlowLogsConfigRequest; + + /** + * Creates a plain object from a GetVpcFlowLogsConfigRequest message. Also converts values to other types if specified. + * @param message GetVpcFlowLogsConfigRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.networkmanagement.v1.GetVpcFlowLogsConfigRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this GetVpcFlowLogsConfigRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for GetVpcFlowLogsConfigRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a CreateVpcFlowLogsConfigRequest. */ + interface ICreateVpcFlowLogsConfigRequest { + + /** CreateVpcFlowLogsConfigRequest parent */ + parent?: (string|null); + + /** CreateVpcFlowLogsConfigRequest vpcFlowLogsConfigId */ + vpcFlowLogsConfigId?: (string|null); + + /** CreateVpcFlowLogsConfigRequest vpcFlowLogsConfig */ + vpcFlowLogsConfig?: (google.cloud.networkmanagement.v1.IVpcFlowLogsConfig|null); + } + + /** Represents a CreateVpcFlowLogsConfigRequest. */ + class CreateVpcFlowLogsConfigRequest implements ICreateVpcFlowLogsConfigRequest { + + /** + * Constructs a new CreateVpcFlowLogsConfigRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.networkmanagement.v1.ICreateVpcFlowLogsConfigRequest); + + /** CreateVpcFlowLogsConfigRequest parent. */ + public parent: string; + + /** CreateVpcFlowLogsConfigRequest vpcFlowLogsConfigId. */ + public vpcFlowLogsConfigId: string; + + /** CreateVpcFlowLogsConfigRequest vpcFlowLogsConfig. */ + public vpcFlowLogsConfig?: (google.cloud.networkmanagement.v1.IVpcFlowLogsConfig|null); + + /** + * Creates a new CreateVpcFlowLogsConfigRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns CreateVpcFlowLogsConfigRequest instance + */ + public static create(properties?: google.cloud.networkmanagement.v1.ICreateVpcFlowLogsConfigRequest): google.cloud.networkmanagement.v1.CreateVpcFlowLogsConfigRequest; + + /** + * Encodes the specified CreateVpcFlowLogsConfigRequest message. Does not implicitly {@link google.cloud.networkmanagement.v1.CreateVpcFlowLogsConfigRequest.verify|verify} messages. + * @param message CreateVpcFlowLogsConfigRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.networkmanagement.v1.ICreateVpcFlowLogsConfigRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified CreateVpcFlowLogsConfigRequest message, length delimited. Does not implicitly {@link google.cloud.networkmanagement.v1.CreateVpcFlowLogsConfigRequest.verify|verify} messages. + * @param message CreateVpcFlowLogsConfigRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.networkmanagement.v1.ICreateVpcFlowLogsConfigRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a CreateVpcFlowLogsConfigRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns CreateVpcFlowLogsConfigRequest + * @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.networkmanagement.v1.CreateVpcFlowLogsConfigRequest; + + /** + * Decodes a CreateVpcFlowLogsConfigRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns CreateVpcFlowLogsConfigRequest + * @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.networkmanagement.v1.CreateVpcFlowLogsConfigRequest; + + /** + * Verifies a CreateVpcFlowLogsConfigRequest 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 CreateVpcFlowLogsConfigRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns CreateVpcFlowLogsConfigRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.networkmanagement.v1.CreateVpcFlowLogsConfigRequest; + + /** + * Creates a plain object from a CreateVpcFlowLogsConfigRequest message. Also converts values to other types if specified. + * @param message CreateVpcFlowLogsConfigRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.networkmanagement.v1.CreateVpcFlowLogsConfigRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this CreateVpcFlowLogsConfigRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for CreateVpcFlowLogsConfigRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an UpdateVpcFlowLogsConfigRequest. */ + interface IUpdateVpcFlowLogsConfigRequest { + + /** UpdateVpcFlowLogsConfigRequest updateMask */ + updateMask?: (google.protobuf.IFieldMask|null); + + /** UpdateVpcFlowLogsConfigRequest vpcFlowLogsConfig */ + vpcFlowLogsConfig?: (google.cloud.networkmanagement.v1.IVpcFlowLogsConfig|null); + } + + /** Represents an UpdateVpcFlowLogsConfigRequest. */ + class UpdateVpcFlowLogsConfigRequest implements IUpdateVpcFlowLogsConfigRequest { + + /** + * Constructs a new UpdateVpcFlowLogsConfigRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.networkmanagement.v1.IUpdateVpcFlowLogsConfigRequest); + + /** UpdateVpcFlowLogsConfigRequest updateMask. */ + public updateMask?: (google.protobuf.IFieldMask|null); + + /** UpdateVpcFlowLogsConfigRequest vpcFlowLogsConfig. */ + public vpcFlowLogsConfig?: (google.cloud.networkmanagement.v1.IVpcFlowLogsConfig|null); + + /** + * Creates a new UpdateVpcFlowLogsConfigRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns UpdateVpcFlowLogsConfigRequest instance + */ + public static create(properties?: google.cloud.networkmanagement.v1.IUpdateVpcFlowLogsConfigRequest): google.cloud.networkmanagement.v1.UpdateVpcFlowLogsConfigRequest; + + /** + * Encodes the specified UpdateVpcFlowLogsConfigRequest message. Does not implicitly {@link google.cloud.networkmanagement.v1.UpdateVpcFlowLogsConfigRequest.verify|verify} messages. + * @param message UpdateVpcFlowLogsConfigRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.networkmanagement.v1.IUpdateVpcFlowLogsConfigRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified UpdateVpcFlowLogsConfigRequest message, length delimited. Does not implicitly {@link google.cloud.networkmanagement.v1.UpdateVpcFlowLogsConfigRequest.verify|verify} messages. + * @param message UpdateVpcFlowLogsConfigRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.networkmanagement.v1.IUpdateVpcFlowLogsConfigRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an UpdateVpcFlowLogsConfigRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns UpdateVpcFlowLogsConfigRequest + * @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.networkmanagement.v1.UpdateVpcFlowLogsConfigRequest; + + /** + * Decodes an UpdateVpcFlowLogsConfigRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns UpdateVpcFlowLogsConfigRequest + * @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.networkmanagement.v1.UpdateVpcFlowLogsConfigRequest; + + /** + * Verifies an UpdateVpcFlowLogsConfigRequest 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 UpdateVpcFlowLogsConfigRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns UpdateVpcFlowLogsConfigRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.networkmanagement.v1.UpdateVpcFlowLogsConfigRequest; + + /** + * Creates a plain object from an UpdateVpcFlowLogsConfigRequest message. Also converts values to other types if specified. + * @param message UpdateVpcFlowLogsConfigRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.networkmanagement.v1.UpdateVpcFlowLogsConfigRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this UpdateVpcFlowLogsConfigRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for UpdateVpcFlowLogsConfigRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a DeleteVpcFlowLogsConfigRequest. */ + interface IDeleteVpcFlowLogsConfigRequest { + + /** DeleteVpcFlowLogsConfigRequest name */ + name?: (string|null); + } + + /** Represents a DeleteVpcFlowLogsConfigRequest. */ + class DeleteVpcFlowLogsConfigRequest implements IDeleteVpcFlowLogsConfigRequest { + + /** + * Constructs a new DeleteVpcFlowLogsConfigRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.networkmanagement.v1.IDeleteVpcFlowLogsConfigRequest); + + /** DeleteVpcFlowLogsConfigRequest name. */ + public name: string; + + /** + * Creates a new DeleteVpcFlowLogsConfigRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns DeleteVpcFlowLogsConfigRequest instance + */ + public static create(properties?: google.cloud.networkmanagement.v1.IDeleteVpcFlowLogsConfigRequest): google.cloud.networkmanagement.v1.DeleteVpcFlowLogsConfigRequest; + + /** + * Encodes the specified DeleteVpcFlowLogsConfigRequest message. Does not implicitly {@link google.cloud.networkmanagement.v1.DeleteVpcFlowLogsConfigRequest.verify|verify} messages. + * @param message DeleteVpcFlowLogsConfigRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.networkmanagement.v1.IDeleteVpcFlowLogsConfigRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DeleteVpcFlowLogsConfigRequest message, length delimited. Does not implicitly {@link google.cloud.networkmanagement.v1.DeleteVpcFlowLogsConfigRequest.verify|verify} messages. + * @param message DeleteVpcFlowLogsConfigRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.networkmanagement.v1.IDeleteVpcFlowLogsConfigRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DeleteVpcFlowLogsConfigRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DeleteVpcFlowLogsConfigRequest + * @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.networkmanagement.v1.DeleteVpcFlowLogsConfigRequest; + + /** + * Decodes a DeleteVpcFlowLogsConfigRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DeleteVpcFlowLogsConfigRequest + * @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.networkmanagement.v1.DeleteVpcFlowLogsConfigRequest; + + /** + * Verifies a DeleteVpcFlowLogsConfigRequest 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 DeleteVpcFlowLogsConfigRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DeleteVpcFlowLogsConfigRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.networkmanagement.v1.DeleteVpcFlowLogsConfigRequest; + + /** + * Creates a plain object from a DeleteVpcFlowLogsConfigRequest message. Also converts values to other types if specified. + * @param message DeleteVpcFlowLogsConfigRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.networkmanagement.v1.DeleteVpcFlowLogsConfigRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DeleteVpcFlowLogsConfigRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for DeleteVpcFlowLogsConfigRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a VpcFlowLogsConfig. */ + interface IVpcFlowLogsConfig { + + /** VpcFlowLogsConfig name */ + name?: (string|null); + + /** VpcFlowLogsConfig description */ + description?: (string|null); + + /** VpcFlowLogsConfig state */ + state?: (google.cloud.networkmanagement.v1.VpcFlowLogsConfig.State|keyof typeof google.cloud.networkmanagement.v1.VpcFlowLogsConfig.State|null); + + /** VpcFlowLogsConfig aggregationInterval */ + aggregationInterval?: (google.cloud.networkmanagement.v1.VpcFlowLogsConfig.AggregationInterval|keyof typeof google.cloud.networkmanagement.v1.VpcFlowLogsConfig.AggregationInterval|null); + + /** VpcFlowLogsConfig flowSampling */ + flowSampling?: (number|null); + + /** VpcFlowLogsConfig metadata */ + metadata?: (google.cloud.networkmanagement.v1.VpcFlowLogsConfig.Metadata|keyof typeof google.cloud.networkmanagement.v1.VpcFlowLogsConfig.Metadata|null); + + /** VpcFlowLogsConfig metadataFields */ + metadataFields?: (string[]|null); + + /** VpcFlowLogsConfig filterExpr */ + filterExpr?: (string|null); + + /** VpcFlowLogsConfig targetResourceState */ + targetResourceState?: (google.cloud.networkmanagement.v1.VpcFlowLogsConfig.TargetResourceState|keyof typeof google.cloud.networkmanagement.v1.VpcFlowLogsConfig.TargetResourceState|null); + + /** VpcFlowLogsConfig interconnectAttachment */ + interconnectAttachment?: (string|null); + + /** VpcFlowLogsConfig vpnTunnel */ + vpnTunnel?: (string|null); + + /** VpcFlowLogsConfig labels */ + labels?: ({ [k: string]: string }|null); + + /** VpcFlowLogsConfig createTime */ + createTime?: (google.protobuf.ITimestamp|null); + + /** VpcFlowLogsConfig updateTime */ + updateTime?: (google.protobuf.ITimestamp|null); + } + + /** Represents a VpcFlowLogsConfig. */ + class VpcFlowLogsConfig implements IVpcFlowLogsConfig { + + /** + * Constructs a new VpcFlowLogsConfig. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.networkmanagement.v1.IVpcFlowLogsConfig); + + /** VpcFlowLogsConfig name. */ + public name: string; + + /** VpcFlowLogsConfig description. */ + public description?: (string|null); + + /** VpcFlowLogsConfig state. */ + public state?: (google.cloud.networkmanagement.v1.VpcFlowLogsConfig.State|keyof typeof google.cloud.networkmanagement.v1.VpcFlowLogsConfig.State|null); + + /** VpcFlowLogsConfig aggregationInterval. */ + public aggregationInterval?: (google.cloud.networkmanagement.v1.VpcFlowLogsConfig.AggregationInterval|keyof typeof google.cloud.networkmanagement.v1.VpcFlowLogsConfig.AggregationInterval|null); + + /** VpcFlowLogsConfig flowSampling. */ + public flowSampling?: (number|null); + + /** VpcFlowLogsConfig metadata. */ + public metadata?: (google.cloud.networkmanagement.v1.VpcFlowLogsConfig.Metadata|keyof typeof google.cloud.networkmanagement.v1.VpcFlowLogsConfig.Metadata|null); + + /** VpcFlowLogsConfig metadataFields. */ + public metadataFields: string[]; + + /** VpcFlowLogsConfig filterExpr. */ + public filterExpr?: (string|null); + + /** VpcFlowLogsConfig targetResourceState. */ + public targetResourceState?: (google.cloud.networkmanagement.v1.VpcFlowLogsConfig.TargetResourceState|keyof typeof google.cloud.networkmanagement.v1.VpcFlowLogsConfig.TargetResourceState|null); + + /** VpcFlowLogsConfig interconnectAttachment. */ + public interconnectAttachment?: (string|null); + + /** VpcFlowLogsConfig vpnTunnel. */ + public vpnTunnel?: (string|null); + + /** VpcFlowLogsConfig labels. */ + public labels: { [k: string]: string }; + + /** VpcFlowLogsConfig createTime. */ + public createTime?: (google.protobuf.ITimestamp|null); + + /** VpcFlowLogsConfig updateTime. */ + public updateTime?: (google.protobuf.ITimestamp|null); + + /** VpcFlowLogsConfig _description. */ + public _description?: "description"; + + /** VpcFlowLogsConfig _state. */ + public _state?: "state"; + + /** VpcFlowLogsConfig _aggregationInterval. */ + public _aggregationInterval?: "aggregationInterval"; + + /** VpcFlowLogsConfig _flowSampling. */ + public _flowSampling?: "flowSampling"; + + /** VpcFlowLogsConfig _metadata. */ + public _metadata?: "metadata"; + + /** VpcFlowLogsConfig _filterExpr. */ + public _filterExpr?: "filterExpr"; + + /** VpcFlowLogsConfig _targetResourceState. */ + public _targetResourceState?: "targetResourceState"; + + /** VpcFlowLogsConfig targetResource. */ + public targetResource?: ("interconnectAttachment"|"vpnTunnel"); + + /** + * Creates a new VpcFlowLogsConfig instance using the specified properties. + * @param [properties] Properties to set + * @returns VpcFlowLogsConfig instance + */ + public static create(properties?: google.cloud.networkmanagement.v1.IVpcFlowLogsConfig): google.cloud.networkmanagement.v1.VpcFlowLogsConfig; + + /** + * Encodes the specified VpcFlowLogsConfig message. Does not implicitly {@link google.cloud.networkmanagement.v1.VpcFlowLogsConfig.verify|verify} messages. + * @param message VpcFlowLogsConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.networkmanagement.v1.IVpcFlowLogsConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified VpcFlowLogsConfig message, length delimited. Does not implicitly {@link google.cloud.networkmanagement.v1.VpcFlowLogsConfig.verify|verify} messages. + * @param message VpcFlowLogsConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.networkmanagement.v1.IVpcFlowLogsConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a VpcFlowLogsConfig message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns VpcFlowLogsConfig + * @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.networkmanagement.v1.VpcFlowLogsConfig; + + /** + * Decodes a VpcFlowLogsConfig message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns VpcFlowLogsConfig + * @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.networkmanagement.v1.VpcFlowLogsConfig; + + /** + * Verifies a VpcFlowLogsConfig 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 VpcFlowLogsConfig message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns VpcFlowLogsConfig + */ + public static fromObject(object: { [k: string]: any }): google.cloud.networkmanagement.v1.VpcFlowLogsConfig; + + /** + * Creates a plain object from a VpcFlowLogsConfig message. Also converts values to other types if specified. + * @param message VpcFlowLogsConfig + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.networkmanagement.v1.VpcFlowLogsConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this VpcFlowLogsConfig to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for VpcFlowLogsConfig + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace VpcFlowLogsConfig { + + /** State enum. */ + enum State { + STATE_UNSPECIFIED = 0, + ENABLED = 1, + DISABLED = 2 + } + + /** AggregationInterval enum. */ + enum AggregationInterval { + AGGREGATION_INTERVAL_UNSPECIFIED = 0, + INTERVAL_5_SEC = 1, + INTERVAL_30_SEC = 2, + INTERVAL_1_MIN = 3, + INTERVAL_5_MIN = 4, + INTERVAL_10_MIN = 5, + INTERVAL_15_MIN = 6 + } + + /** Metadata enum. */ + enum Metadata { + METADATA_UNSPECIFIED = 0, + INCLUDE_ALL_METADATA = 1, + EXCLUDE_ALL_METADATA = 2, + CUSTOM_METADATA = 3 + } + + /** TargetResourceState enum. */ + enum TargetResourceState { + TARGET_RESOURCE_STATE_UNSPECIFIED = 0, + TARGET_RESOURCE_EXISTS = 1, + TARGET_RESOURCE_DOES_NOT_EXIST = 2 + } + } } /** Namespace v1beta1. */ diff --git a/packages/google-cloud-networkmanagement/protos/protos.js b/packages/google-cloud-networkmanagement/protos/protos.js index c0c83d6caea..0397ef3a267 100644 --- a/packages/google-cloud-networkmanagement/protos/protos.js +++ b/packages/google-cloud-networkmanagement/protos/protos.js @@ -19001,6 +19001,2579 @@ return OperationMetadata; })(); + v1.VpcFlowLogsService = (function() { + + /** + * Constructs a new VpcFlowLogsService service. + * @memberof google.cloud.networkmanagement.v1 + * @classdesc Represents a VpcFlowLogsService + * @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 VpcFlowLogsService(rpcImpl, requestDelimited, responseDelimited) { + $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); + } + + (VpcFlowLogsService.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = VpcFlowLogsService; + + /** + * Creates new VpcFlowLogsService service using the specified rpc implementation. + * @function create + * @memberof google.cloud.networkmanagement.v1.VpcFlowLogsService + * @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 {VpcFlowLogsService} RPC service. Useful where requests and/or responses are streamed. + */ + VpcFlowLogsService.create = function create(rpcImpl, requestDelimited, responseDelimited) { + return new this(rpcImpl, requestDelimited, responseDelimited); + }; + + /** + * Callback as used by {@link google.cloud.networkmanagement.v1.VpcFlowLogsService|listVpcFlowLogsConfigs}. + * @memberof google.cloud.networkmanagement.v1.VpcFlowLogsService + * @typedef ListVpcFlowLogsConfigsCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.networkmanagement.v1.ListVpcFlowLogsConfigsResponse} [response] ListVpcFlowLogsConfigsResponse + */ + + /** + * Calls ListVpcFlowLogsConfigs. + * @function listVpcFlowLogsConfigs + * @memberof google.cloud.networkmanagement.v1.VpcFlowLogsService + * @instance + * @param {google.cloud.networkmanagement.v1.IListVpcFlowLogsConfigsRequest} request ListVpcFlowLogsConfigsRequest message or plain object + * @param {google.cloud.networkmanagement.v1.VpcFlowLogsService.ListVpcFlowLogsConfigsCallback} callback Node-style callback called with the error, if any, and ListVpcFlowLogsConfigsResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(VpcFlowLogsService.prototype.listVpcFlowLogsConfigs = function listVpcFlowLogsConfigs(request, callback) { + return this.rpcCall(listVpcFlowLogsConfigs, $root.google.cloud.networkmanagement.v1.ListVpcFlowLogsConfigsRequest, $root.google.cloud.networkmanagement.v1.ListVpcFlowLogsConfigsResponse, request, callback); + }, "name", { value: "ListVpcFlowLogsConfigs" }); + + /** + * Calls ListVpcFlowLogsConfigs. + * @function listVpcFlowLogsConfigs + * @memberof google.cloud.networkmanagement.v1.VpcFlowLogsService + * @instance + * @param {google.cloud.networkmanagement.v1.IListVpcFlowLogsConfigsRequest} request ListVpcFlowLogsConfigsRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.networkmanagement.v1.VpcFlowLogsService|getVpcFlowLogsConfig}. + * @memberof google.cloud.networkmanagement.v1.VpcFlowLogsService + * @typedef GetVpcFlowLogsConfigCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.networkmanagement.v1.VpcFlowLogsConfig} [response] VpcFlowLogsConfig + */ + + /** + * Calls GetVpcFlowLogsConfig. + * @function getVpcFlowLogsConfig + * @memberof google.cloud.networkmanagement.v1.VpcFlowLogsService + * @instance + * @param {google.cloud.networkmanagement.v1.IGetVpcFlowLogsConfigRequest} request GetVpcFlowLogsConfigRequest message or plain object + * @param {google.cloud.networkmanagement.v1.VpcFlowLogsService.GetVpcFlowLogsConfigCallback} callback Node-style callback called with the error, if any, and VpcFlowLogsConfig + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(VpcFlowLogsService.prototype.getVpcFlowLogsConfig = function getVpcFlowLogsConfig(request, callback) { + return this.rpcCall(getVpcFlowLogsConfig, $root.google.cloud.networkmanagement.v1.GetVpcFlowLogsConfigRequest, $root.google.cloud.networkmanagement.v1.VpcFlowLogsConfig, request, callback); + }, "name", { value: "GetVpcFlowLogsConfig" }); + + /** + * Calls GetVpcFlowLogsConfig. + * @function getVpcFlowLogsConfig + * @memberof google.cloud.networkmanagement.v1.VpcFlowLogsService + * @instance + * @param {google.cloud.networkmanagement.v1.IGetVpcFlowLogsConfigRequest} request GetVpcFlowLogsConfigRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.networkmanagement.v1.VpcFlowLogsService|createVpcFlowLogsConfig}. + * @memberof google.cloud.networkmanagement.v1.VpcFlowLogsService + * @typedef CreateVpcFlowLogsConfigCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls CreateVpcFlowLogsConfig. + * @function createVpcFlowLogsConfig + * @memberof google.cloud.networkmanagement.v1.VpcFlowLogsService + * @instance + * @param {google.cloud.networkmanagement.v1.ICreateVpcFlowLogsConfigRequest} request CreateVpcFlowLogsConfigRequest message or plain object + * @param {google.cloud.networkmanagement.v1.VpcFlowLogsService.CreateVpcFlowLogsConfigCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(VpcFlowLogsService.prototype.createVpcFlowLogsConfig = function createVpcFlowLogsConfig(request, callback) { + return this.rpcCall(createVpcFlowLogsConfig, $root.google.cloud.networkmanagement.v1.CreateVpcFlowLogsConfigRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "CreateVpcFlowLogsConfig" }); + + /** + * Calls CreateVpcFlowLogsConfig. + * @function createVpcFlowLogsConfig + * @memberof google.cloud.networkmanagement.v1.VpcFlowLogsService + * @instance + * @param {google.cloud.networkmanagement.v1.ICreateVpcFlowLogsConfigRequest} request CreateVpcFlowLogsConfigRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.networkmanagement.v1.VpcFlowLogsService|updateVpcFlowLogsConfig}. + * @memberof google.cloud.networkmanagement.v1.VpcFlowLogsService + * @typedef UpdateVpcFlowLogsConfigCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls UpdateVpcFlowLogsConfig. + * @function updateVpcFlowLogsConfig + * @memberof google.cloud.networkmanagement.v1.VpcFlowLogsService + * @instance + * @param {google.cloud.networkmanagement.v1.IUpdateVpcFlowLogsConfigRequest} request UpdateVpcFlowLogsConfigRequest message or plain object + * @param {google.cloud.networkmanagement.v1.VpcFlowLogsService.UpdateVpcFlowLogsConfigCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(VpcFlowLogsService.prototype.updateVpcFlowLogsConfig = function updateVpcFlowLogsConfig(request, callback) { + return this.rpcCall(updateVpcFlowLogsConfig, $root.google.cloud.networkmanagement.v1.UpdateVpcFlowLogsConfigRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "UpdateVpcFlowLogsConfig" }); + + /** + * Calls UpdateVpcFlowLogsConfig. + * @function updateVpcFlowLogsConfig + * @memberof google.cloud.networkmanagement.v1.VpcFlowLogsService + * @instance + * @param {google.cloud.networkmanagement.v1.IUpdateVpcFlowLogsConfigRequest} request UpdateVpcFlowLogsConfigRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.networkmanagement.v1.VpcFlowLogsService|deleteVpcFlowLogsConfig}. + * @memberof google.cloud.networkmanagement.v1.VpcFlowLogsService + * @typedef DeleteVpcFlowLogsConfigCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls DeleteVpcFlowLogsConfig. + * @function deleteVpcFlowLogsConfig + * @memberof google.cloud.networkmanagement.v1.VpcFlowLogsService + * @instance + * @param {google.cloud.networkmanagement.v1.IDeleteVpcFlowLogsConfigRequest} request DeleteVpcFlowLogsConfigRequest message or plain object + * @param {google.cloud.networkmanagement.v1.VpcFlowLogsService.DeleteVpcFlowLogsConfigCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(VpcFlowLogsService.prototype.deleteVpcFlowLogsConfig = function deleteVpcFlowLogsConfig(request, callback) { + return this.rpcCall(deleteVpcFlowLogsConfig, $root.google.cloud.networkmanagement.v1.DeleteVpcFlowLogsConfigRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "DeleteVpcFlowLogsConfig" }); + + /** + * Calls DeleteVpcFlowLogsConfig. + * @function deleteVpcFlowLogsConfig + * @memberof google.cloud.networkmanagement.v1.VpcFlowLogsService + * @instance + * @param {google.cloud.networkmanagement.v1.IDeleteVpcFlowLogsConfigRequest} request DeleteVpcFlowLogsConfigRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + return VpcFlowLogsService; + })(); + + v1.ListVpcFlowLogsConfigsRequest = (function() { + + /** + * Properties of a ListVpcFlowLogsConfigsRequest. + * @memberof google.cloud.networkmanagement.v1 + * @interface IListVpcFlowLogsConfigsRequest + * @property {string|null} [parent] ListVpcFlowLogsConfigsRequest parent + * @property {number|null} [pageSize] ListVpcFlowLogsConfigsRequest pageSize + * @property {string|null} [pageToken] ListVpcFlowLogsConfigsRequest pageToken + * @property {string|null} [filter] ListVpcFlowLogsConfigsRequest filter + * @property {string|null} [orderBy] ListVpcFlowLogsConfigsRequest orderBy + */ + + /** + * Constructs a new ListVpcFlowLogsConfigsRequest. + * @memberof google.cloud.networkmanagement.v1 + * @classdesc Represents a ListVpcFlowLogsConfigsRequest. + * @implements IListVpcFlowLogsConfigsRequest + * @constructor + * @param {google.cloud.networkmanagement.v1.IListVpcFlowLogsConfigsRequest=} [properties] Properties to set + */ + function ListVpcFlowLogsConfigsRequest(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]]; + } + + /** + * ListVpcFlowLogsConfigsRequest parent. + * @member {string} parent + * @memberof google.cloud.networkmanagement.v1.ListVpcFlowLogsConfigsRequest + * @instance + */ + ListVpcFlowLogsConfigsRequest.prototype.parent = ""; + + /** + * ListVpcFlowLogsConfigsRequest pageSize. + * @member {number} pageSize + * @memberof google.cloud.networkmanagement.v1.ListVpcFlowLogsConfigsRequest + * @instance + */ + ListVpcFlowLogsConfigsRequest.prototype.pageSize = 0; + + /** + * ListVpcFlowLogsConfigsRequest pageToken. + * @member {string} pageToken + * @memberof google.cloud.networkmanagement.v1.ListVpcFlowLogsConfigsRequest + * @instance + */ + ListVpcFlowLogsConfigsRequest.prototype.pageToken = ""; + + /** + * ListVpcFlowLogsConfigsRequest filter. + * @member {string} filter + * @memberof google.cloud.networkmanagement.v1.ListVpcFlowLogsConfigsRequest + * @instance + */ + ListVpcFlowLogsConfigsRequest.prototype.filter = ""; + + /** + * ListVpcFlowLogsConfigsRequest orderBy. + * @member {string} orderBy + * @memberof google.cloud.networkmanagement.v1.ListVpcFlowLogsConfigsRequest + * @instance + */ + ListVpcFlowLogsConfigsRequest.prototype.orderBy = ""; + + /** + * Creates a new ListVpcFlowLogsConfigsRequest instance using the specified properties. + * @function create + * @memberof google.cloud.networkmanagement.v1.ListVpcFlowLogsConfigsRequest + * @static + * @param {google.cloud.networkmanagement.v1.IListVpcFlowLogsConfigsRequest=} [properties] Properties to set + * @returns {google.cloud.networkmanagement.v1.ListVpcFlowLogsConfigsRequest} ListVpcFlowLogsConfigsRequest instance + */ + ListVpcFlowLogsConfigsRequest.create = function create(properties) { + return new ListVpcFlowLogsConfigsRequest(properties); + }; + + /** + * Encodes the specified ListVpcFlowLogsConfigsRequest message. Does not implicitly {@link google.cloud.networkmanagement.v1.ListVpcFlowLogsConfigsRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.networkmanagement.v1.ListVpcFlowLogsConfigsRequest + * @static + * @param {google.cloud.networkmanagement.v1.IListVpcFlowLogsConfigsRequest} message ListVpcFlowLogsConfigsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListVpcFlowLogsConfigsRequest.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 ListVpcFlowLogsConfigsRequest message, length delimited. Does not implicitly {@link google.cloud.networkmanagement.v1.ListVpcFlowLogsConfigsRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.networkmanagement.v1.ListVpcFlowLogsConfigsRequest + * @static + * @param {google.cloud.networkmanagement.v1.IListVpcFlowLogsConfigsRequest} message ListVpcFlowLogsConfigsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListVpcFlowLogsConfigsRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListVpcFlowLogsConfigsRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.networkmanagement.v1.ListVpcFlowLogsConfigsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.networkmanagement.v1.ListVpcFlowLogsConfigsRequest} ListVpcFlowLogsConfigsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListVpcFlowLogsConfigsRequest.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.networkmanagement.v1.ListVpcFlowLogsConfigsRequest(); + 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 ListVpcFlowLogsConfigsRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.networkmanagement.v1.ListVpcFlowLogsConfigsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.networkmanagement.v1.ListVpcFlowLogsConfigsRequest} ListVpcFlowLogsConfigsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListVpcFlowLogsConfigsRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListVpcFlowLogsConfigsRequest message. + * @function verify + * @memberof google.cloud.networkmanagement.v1.ListVpcFlowLogsConfigsRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListVpcFlowLogsConfigsRequest.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 ListVpcFlowLogsConfigsRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.networkmanagement.v1.ListVpcFlowLogsConfigsRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.networkmanagement.v1.ListVpcFlowLogsConfigsRequest} ListVpcFlowLogsConfigsRequest + */ + ListVpcFlowLogsConfigsRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.networkmanagement.v1.ListVpcFlowLogsConfigsRequest) + return object; + var message = new $root.google.cloud.networkmanagement.v1.ListVpcFlowLogsConfigsRequest(); + 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 ListVpcFlowLogsConfigsRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.networkmanagement.v1.ListVpcFlowLogsConfigsRequest + * @static + * @param {google.cloud.networkmanagement.v1.ListVpcFlowLogsConfigsRequest} message ListVpcFlowLogsConfigsRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListVpcFlowLogsConfigsRequest.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 ListVpcFlowLogsConfigsRequest to JSON. + * @function toJSON + * @memberof google.cloud.networkmanagement.v1.ListVpcFlowLogsConfigsRequest + * @instance + * @returns {Object.} JSON object + */ + ListVpcFlowLogsConfigsRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ListVpcFlowLogsConfigsRequest + * @function getTypeUrl + * @memberof google.cloud.networkmanagement.v1.ListVpcFlowLogsConfigsRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListVpcFlowLogsConfigsRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.networkmanagement.v1.ListVpcFlowLogsConfigsRequest"; + }; + + return ListVpcFlowLogsConfigsRequest; + })(); + + v1.ListVpcFlowLogsConfigsResponse = (function() { + + /** + * Properties of a ListVpcFlowLogsConfigsResponse. + * @memberof google.cloud.networkmanagement.v1 + * @interface IListVpcFlowLogsConfigsResponse + * @property {Array.|null} [vpcFlowLogsConfigs] ListVpcFlowLogsConfigsResponse vpcFlowLogsConfigs + * @property {string|null} [nextPageToken] ListVpcFlowLogsConfigsResponse nextPageToken + * @property {Array.|null} [unreachable] ListVpcFlowLogsConfigsResponse unreachable + */ + + /** + * Constructs a new ListVpcFlowLogsConfigsResponse. + * @memberof google.cloud.networkmanagement.v1 + * @classdesc Represents a ListVpcFlowLogsConfigsResponse. + * @implements IListVpcFlowLogsConfigsResponse + * @constructor + * @param {google.cloud.networkmanagement.v1.IListVpcFlowLogsConfigsResponse=} [properties] Properties to set + */ + function ListVpcFlowLogsConfigsResponse(properties) { + this.vpcFlowLogsConfigs = []; + 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]]; + } + + /** + * ListVpcFlowLogsConfigsResponse vpcFlowLogsConfigs. + * @member {Array.} vpcFlowLogsConfigs + * @memberof google.cloud.networkmanagement.v1.ListVpcFlowLogsConfigsResponse + * @instance + */ + ListVpcFlowLogsConfigsResponse.prototype.vpcFlowLogsConfigs = $util.emptyArray; + + /** + * ListVpcFlowLogsConfigsResponse nextPageToken. + * @member {string} nextPageToken + * @memberof google.cloud.networkmanagement.v1.ListVpcFlowLogsConfigsResponse + * @instance + */ + ListVpcFlowLogsConfigsResponse.prototype.nextPageToken = ""; + + /** + * ListVpcFlowLogsConfigsResponse unreachable. + * @member {Array.} unreachable + * @memberof google.cloud.networkmanagement.v1.ListVpcFlowLogsConfigsResponse + * @instance + */ + ListVpcFlowLogsConfigsResponse.prototype.unreachable = $util.emptyArray; + + /** + * Creates a new ListVpcFlowLogsConfigsResponse instance using the specified properties. + * @function create + * @memberof google.cloud.networkmanagement.v1.ListVpcFlowLogsConfigsResponse + * @static + * @param {google.cloud.networkmanagement.v1.IListVpcFlowLogsConfigsResponse=} [properties] Properties to set + * @returns {google.cloud.networkmanagement.v1.ListVpcFlowLogsConfigsResponse} ListVpcFlowLogsConfigsResponse instance + */ + ListVpcFlowLogsConfigsResponse.create = function create(properties) { + return new ListVpcFlowLogsConfigsResponse(properties); + }; + + /** + * Encodes the specified ListVpcFlowLogsConfigsResponse message. Does not implicitly {@link google.cloud.networkmanagement.v1.ListVpcFlowLogsConfigsResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.networkmanagement.v1.ListVpcFlowLogsConfigsResponse + * @static + * @param {google.cloud.networkmanagement.v1.IListVpcFlowLogsConfigsResponse} message ListVpcFlowLogsConfigsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListVpcFlowLogsConfigsResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.vpcFlowLogsConfigs != null && message.vpcFlowLogsConfigs.length) + for (var i = 0; i < message.vpcFlowLogsConfigs.length; ++i) + $root.google.cloud.networkmanagement.v1.VpcFlowLogsConfig.encode(message.vpcFlowLogsConfigs[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 ListVpcFlowLogsConfigsResponse message, length delimited. Does not implicitly {@link google.cloud.networkmanagement.v1.ListVpcFlowLogsConfigsResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.networkmanagement.v1.ListVpcFlowLogsConfigsResponse + * @static + * @param {google.cloud.networkmanagement.v1.IListVpcFlowLogsConfigsResponse} message ListVpcFlowLogsConfigsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListVpcFlowLogsConfigsResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListVpcFlowLogsConfigsResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.networkmanagement.v1.ListVpcFlowLogsConfigsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.networkmanagement.v1.ListVpcFlowLogsConfigsResponse} ListVpcFlowLogsConfigsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListVpcFlowLogsConfigsResponse.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.networkmanagement.v1.ListVpcFlowLogsConfigsResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (!(message.vpcFlowLogsConfigs && message.vpcFlowLogsConfigs.length)) + message.vpcFlowLogsConfigs = []; + message.vpcFlowLogsConfigs.push($root.google.cloud.networkmanagement.v1.VpcFlowLogsConfig.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 ListVpcFlowLogsConfigsResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.networkmanagement.v1.ListVpcFlowLogsConfigsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.networkmanagement.v1.ListVpcFlowLogsConfigsResponse} ListVpcFlowLogsConfigsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListVpcFlowLogsConfigsResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListVpcFlowLogsConfigsResponse message. + * @function verify + * @memberof google.cloud.networkmanagement.v1.ListVpcFlowLogsConfigsResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListVpcFlowLogsConfigsResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.vpcFlowLogsConfigs != null && message.hasOwnProperty("vpcFlowLogsConfigs")) { + if (!Array.isArray(message.vpcFlowLogsConfigs)) + return "vpcFlowLogsConfigs: array expected"; + for (var i = 0; i < message.vpcFlowLogsConfigs.length; ++i) { + var error = $root.google.cloud.networkmanagement.v1.VpcFlowLogsConfig.verify(message.vpcFlowLogsConfigs[i]); + if (error) + return "vpcFlowLogsConfigs." + 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 ListVpcFlowLogsConfigsResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.networkmanagement.v1.ListVpcFlowLogsConfigsResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.networkmanagement.v1.ListVpcFlowLogsConfigsResponse} ListVpcFlowLogsConfigsResponse + */ + ListVpcFlowLogsConfigsResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.networkmanagement.v1.ListVpcFlowLogsConfigsResponse) + return object; + var message = new $root.google.cloud.networkmanagement.v1.ListVpcFlowLogsConfigsResponse(); + if (object.vpcFlowLogsConfigs) { + if (!Array.isArray(object.vpcFlowLogsConfigs)) + throw TypeError(".google.cloud.networkmanagement.v1.ListVpcFlowLogsConfigsResponse.vpcFlowLogsConfigs: array expected"); + message.vpcFlowLogsConfigs = []; + for (var i = 0; i < object.vpcFlowLogsConfigs.length; ++i) { + if (typeof object.vpcFlowLogsConfigs[i] !== "object") + throw TypeError(".google.cloud.networkmanagement.v1.ListVpcFlowLogsConfigsResponse.vpcFlowLogsConfigs: object expected"); + message.vpcFlowLogsConfigs[i] = $root.google.cloud.networkmanagement.v1.VpcFlowLogsConfig.fromObject(object.vpcFlowLogsConfigs[i]); + } + } + if (object.nextPageToken != null) + message.nextPageToken = String(object.nextPageToken); + if (object.unreachable) { + if (!Array.isArray(object.unreachable)) + throw TypeError(".google.cloud.networkmanagement.v1.ListVpcFlowLogsConfigsResponse.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 ListVpcFlowLogsConfigsResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.networkmanagement.v1.ListVpcFlowLogsConfigsResponse + * @static + * @param {google.cloud.networkmanagement.v1.ListVpcFlowLogsConfigsResponse} message ListVpcFlowLogsConfigsResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListVpcFlowLogsConfigsResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.vpcFlowLogsConfigs = []; + object.unreachable = []; + } + if (options.defaults) + object.nextPageToken = ""; + if (message.vpcFlowLogsConfigs && message.vpcFlowLogsConfigs.length) { + object.vpcFlowLogsConfigs = []; + for (var j = 0; j < message.vpcFlowLogsConfigs.length; ++j) + object.vpcFlowLogsConfigs[j] = $root.google.cloud.networkmanagement.v1.VpcFlowLogsConfig.toObject(message.vpcFlowLogsConfigs[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 ListVpcFlowLogsConfigsResponse to JSON. + * @function toJSON + * @memberof google.cloud.networkmanagement.v1.ListVpcFlowLogsConfigsResponse + * @instance + * @returns {Object.} JSON object + */ + ListVpcFlowLogsConfigsResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ListVpcFlowLogsConfigsResponse + * @function getTypeUrl + * @memberof google.cloud.networkmanagement.v1.ListVpcFlowLogsConfigsResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListVpcFlowLogsConfigsResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.networkmanagement.v1.ListVpcFlowLogsConfigsResponse"; + }; + + return ListVpcFlowLogsConfigsResponse; + })(); + + v1.GetVpcFlowLogsConfigRequest = (function() { + + /** + * Properties of a GetVpcFlowLogsConfigRequest. + * @memberof google.cloud.networkmanagement.v1 + * @interface IGetVpcFlowLogsConfigRequest + * @property {string|null} [name] GetVpcFlowLogsConfigRequest name + */ + + /** + * Constructs a new GetVpcFlowLogsConfigRequest. + * @memberof google.cloud.networkmanagement.v1 + * @classdesc Represents a GetVpcFlowLogsConfigRequest. + * @implements IGetVpcFlowLogsConfigRequest + * @constructor + * @param {google.cloud.networkmanagement.v1.IGetVpcFlowLogsConfigRequest=} [properties] Properties to set + */ + function GetVpcFlowLogsConfigRequest(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]]; + } + + /** + * GetVpcFlowLogsConfigRequest name. + * @member {string} name + * @memberof google.cloud.networkmanagement.v1.GetVpcFlowLogsConfigRequest + * @instance + */ + GetVpcFlowLogsConfigRequest.prototype.name = ""; + + /** + * Creates a new GetVpcFlowLogsConfigRequest instance using the specified properties. + * @function create + * @memberof google.cloud.networkmanagement.v1.GetVpcFlowLogsConfigRequest + * @static + * @param {google.cloud.networkmanagement.v1.IGetVpcFlowLogsConfigRequest=} [properties] Properties to set + * @returns {google.cloud.networkmanagement.v1.GetVpcFlowLogsConfigRequest} GetVpcFlowLogsConfigRequest instance + */ + GetVpcFlowLogsConfigRequest.create = function create(properties) { + return new GetVpcFlowLogsConfigRequest(properties); + }; + + /** + * Encodes the specified GetVpcFlowLogsConfigRequest message. Does not implicitly {@link google.cloud.networkmanagement.v1.GetVpcFlowLogsConfigRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.networkmanagement.v1.GetVpcFlowLogsConfigRequest + * @static + * @param {google.cloud.networkmanagement.v1.IGetVpcFlowLogsConfigRequest} message GetVpcFlowLogsConfigRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetVpcFlowLogsConfigRequest.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 GetVpcFlowLogsConfigRequest message, length delimited. Does not implicitly {@link google.cloud.networkmanagement.v1.GetVpcFlowLogsConfigRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.networkmanagement.v1.GetVpcFlowLogsConfigRequest + * @static + * @param {google.cloud.networkmanagement.v1.IGetVpcFlowLogsConfigRequest} message GetVpcFlowLogsConfigRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetVpcFlowLogsConfigRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GetVpcFlowLogsConfigRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.networkmanagement.v1.GetVpcFlowLogsConfigRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.networkmanagement.v1.GetVpcFlowLogsConfigRequest} GetVpcFlowLogsConfigRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetVpcFlowLogsConfigRequest.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.networkmanagement.v1.GetVpcFlowLogsConfigRequest(); + 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 GetVpcFlowLogsConfigRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.networkmanagement.v1.GetVpcFlowLogsConfigRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.networkmanagement.v1.GetVpcFlowLogsConfigRequest} GetVpcFlowLogsConfigRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetVpcFlowLogsConfigRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GetVpcFlowLogsConfigRequest message. + * @function verify + * @memberof google.cloud.networkmanagement.v1.GetVpcFlowLogsConfigRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GetVpcFlowLogsConfigRequest.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 GetVpcFlowLogsConfigRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.networkmanagement.v1.GetVpcFlowLogsConfigRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.networkmanagement.v1.GetVpcFlowLogsConfigRequest} GetVpcFlowLogsConfigRequest + */ + GetVpcFlowLogsConfigRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.networkmanagement.v1.GetVpcFlowLogsConfigRequest) + return object; + var message = new $root.google.cloud.networkmanagement.v1.GetVpcFlowLogsConfigRequest(); + if (object.name != null) + message.name = String(object.name); + return message; + }; + + /** + * Creates a plain object from a GetVpcFlowLogsConfigRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.networkmanagement.v1.GetVpcFlowLogsConfigRequest + * @static + * @param {google.cloud.networkmanagement.v1.GetVpcFlowLogsConfigRequest} message GetVpcFlowLogsConfigRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GetVpcFlowLogsConfigRequest.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 GetVpcFlowLogsConfigRequest to JSON. + * @function toJSON + * @memberof google.cloud.networkmanagement.v1.GetVpcFlowLogsConfigRequest + * @instance + * @returns {Object.} JSON object + */ + GetVpcFlowLogsConfigRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for GetVpcFlowLogsConfigRequest + * @function getTypeUrl + * @memberof google.cloud.networkmanagement.v1.GetVpcFlowLogsConfigRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + GetVpcFlowLogsConfigRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.networkmanagement.v1.GetVpcFlowLogsConfigRequest"; + }; + + return GetVpcFlowLogsConfigRequest; + })(); + + v1.CreateVpcFlowLogsConfigRequest = (function() { + + /** + * Properties of a CreateVpcFlowLogsConfigRequest. + * @memberof google.cloud.networkmanagement.v1 + * @interface ICreateVpcFlowLogsConfigRequest + * @property {string|null} [parent] CreateVpcFlowLogsConfigRequest parent + * @property {string|null} [vpcFlowLogsConfigId] CreateVpcFlowLogsConfigRequest vpcFlowLogsConfigId + * @property {google.cloud.networkmanagement.v1.IVpcFlowLogsConfig|null} [vpcFlowLogsConfig] CreateVpcFlowLogsConfigRequest vpcFlowLogsConfig + */ + + /** + * Constructs a new CreateVpcFlowLogsConfigRequest. + * @memberof google.cloud.networkmanagement.v1 + * @classdesc Represents a CreateVpcFlowLogsConfigRequest. + * @implements ICreateVpcFlowLogsConfigRequest + * @constructor + * @param {google.cloud.networkmanagement.v1.ICreateVpcFlowLogsConfigRequest=} [properties] Properties to set + */ + function CreateVpcFlowLogsConfigRequest(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]]; + } + + /** + * CreateVpcFlowLogsConfigRequest parent. + * @member {string} parent + * @memberof google.cloud.networkmanagement.v1.CreateVpcFlowLogsConfigRequest + * @instance + */ + CreateVpcFlowLogsConfigRequest.prototype.parent = ""; + + /** + * CreateVpcFlowLogsConfigRequest vpcFlowLogsConfigId. + * @member {string} vpcFlowLogsConfigId + * @memberof google.cloud.networkmanagement.v1.CreateVpcFlowLogsConfigRequest + * @instance + */ + CreateVpcFlowLogsConfigRequest.prototype.vpcFlowLogsConfigId = ""; + + /** + * CreateVpcFlowLogsConfigRequest vpcFlowLogsConfig. + * @member {google.cloud.networkmanagement.v1.IVpcFlowLogsConfig|null|undefined} vpcFlowLogsConfig + * @memberof google.cloud.networkmanagement.v1.CreateVpcFlowLogsConfigRequest + * @instance + */ + CreateVpcFlowLogsConfigRequest.prototype.vpcFlowLogsConfig = null; + + /** + * Creates a new CreateVpcFlowLogsConfigRequest instance using the specified properties. + * @function create + * @memberof google.cloud.networkmanagement.v1.CreateVpcFlowLogsConfigRequest + * @static + * @param {google.cloud.networkmanagement.v1.ICreateVpcFlowLogsConfigRequest=} [properties] Properties to set + * @returns {google.cloud.networkmanagement.v1.CreateVpcFlowLogsConfigRequest} CreateVpcFlowLogsConfigRequest instance + */ + CreateVpcFlowLogsConfigRequest.create = function create(properties) { + return new CreateVpcFlowLogsConfigRequest(properties); + }; + + /** + * Encodes the specified CreateVpcFlowLogsConfigRequest message. Does not implicitly {@link google.cloud.networkmanagement.v1.CreateVpcFlowLogsConfigRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.networkmanagement.v1.CreateVpcFlowLogsConfigRequest + * @static + * @param {google.cloud.networkmanagement.v1.ICreateVpcFlowLogsConfigRequest} message CreateVpcFlowLogsConfigRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CreateVpcFlowLogsConfigRequest.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.vpcFlowLogsConfigId != null && Object.hasOwnProperty.call(message, "vpcFlowLogsConfigId")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.vpcFlowLogsConfigId); + if (message.vpcFlowLogsConfig != null && Object.hasOwnProperty.call(message, "vpcFlowLogsConfig")) + $root.google.cloud.networkmanagement.v1.VpcFlowLogsConfig.encode(message.vpcFlowLogsConfig, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified CreateVpcFlowLogsConfigRequest message, length delimited. Does not implicitly {@link google.cloud.networkmanagement.v1.CreateVpcFlowLogsConfigRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.networkmanagement.v1.CreateVpcFlowLogsConfigRequest + * @static + * @param {google.cloud.networkmanagement.v1.ICreateVpcFlowLogsConfigRequest} message CreateVpcFlowLogsConfigRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CreateVpcFlowLogsConfigRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a CreateVpcFlowLogsConfigRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.networkmanagement.v1.CreateVpcFlowLogsConfigRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.networkmanagement.v1.CreateVpcFlowLogsConfigRequest} CreateVpcFlowLogsConfigRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CreateVpcFlowLogsConfigRequest.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.networkmanagement.v1.CreateVpcFlowLogsConfigRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.parent = reader.string(); + break; + } + case 2: { + message.vpcFlowLogsConfigId = reader.string(); + break; + } + case 3: { + message.vpcFlowLogsConfig = $root.google.cloud.networkmanagement.v1.VpcFlowLogsConfig.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a CreateVpcFlowLogsConfigRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.networkmanagement.v1.CreateVpcFlowLogsConfigRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.networkmanagement.v1.CreateVpcFlowLogsConfigRequest} CreateVpcFlowLogsConfigRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CreateVpcFlowLogsConfigRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a CreateVpcFlowLogsConfigRequest message. + * @function verify + * @memberof google.cloud.networkmanagement.v1.CreateVpcFlowLogsConfigRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + CreateVpcFlowLogsConfigRequest.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.vpcFlowLogsConfigId != null && message.hasOwnProperty("vpcFlowLogsConfigId")) + if (!$util.isString(message.vpcFlowLogsConfigId)) + return "vpcFlowLogsConfigId: string expected"; + if (message.vpcFlowLogsConfig != null && message.hasOwnProperty("vpcFlowLogsConfig")) { + var error = $root.google.cloud.networkmanagement.v1.VpcFlowLogsConfig.verify(message.vpcFlowLogsConfig); + if (error) + return "vpcFlowLogsConfig." + error; + } + return null; + }; + + /** + * Creates a CreateVpcFlowLogsConfigRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.networkmanagement.v1.CreateVpcFlowLogsConfigRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.networkmanagement.v1.CreateVpcFlowLogsConfigRequest} CreateVpcFlowLogsConfigRequest + */ + CreateVpcFlowLogsConfigRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.networkmanagement.v1.CreateVpcFlowLogsConfigRequest) + return object; + var message = new $root.google.cloud.networkmanagement.v1.CreateVpcFlowLogsConfigRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.vpcFlowLogsConfigId != null) + message.vpcFlowLogsConfigId = String(object.vpcFlowLogsConfigId); + if (object.vpcFlowLogsConfig != null) { + if (typeof object.vpcFlowLogsConfig !== "object") + throw TypeError(".google.cloud.networkmanagement.v1.CreateVpcFlowLogsConfigRequest.vpcFlowLogsConfig: object expected"); + message.vpcFlowLogsConfig = $root.google.cloud.networkmanagement.v1.VpcFlowLogsConfig.fromObject(object.vpcFlowLogsConfig); + } + return message; + }; + + /** + * Creates a plain object from a CreateVpcFlowLogsConfigRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.networkmanagement.v1.CreateVpcFlowLogsConfigRequest + * @static + * @param {google.cloud.networkmanagement.v1.CreateVpcFlowLogsConfigRequest} message CreateVpcFlowLogsConfigRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + CreateVpcFlowLogsConfigRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object.vpcFlowLogsConfigId = ""; + object.vpcFlowLogsConfig = null; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.vpcFlowLogsConfigId != null && message.hasOwnProperty("vpcFlowLogsConfigId")) + object.vpcFlowLogsConfigId = message.vpcFlowLogsConfigId; + if (message.vpcFlowLogsConfig != null && message.hasOwnProperty("vpcFlowLogsConfig")) + object.vpcFlowLogsConfig = $root.google.cloud.networkmanagement.v1.VpcFlowLogsConfig.toObject(message.vpcFlowLogsConfig, options); + return object; + }; + + /** + * Converts this CreateVpcFlowLogsConfigRequest to JSON. + * @function toJSON + * @memberof google.cloud.networkmanagement.v1.CreateVpcFlowLogsConfigRequest + * @instance + * @returns {Object.} JSON object + */ + CreateVpcFlowLogsConfigRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for CreateVpcFlowLogsConfigRequest + * @function getTypeUrl + * @memberof google.cloud.networkmanagement.v1.CreateVpcFlowLogsConfigRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + CreateVpcFlowLogsConfigRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.networkmanagement.v1.CreateVpcFlowLogsConfigRequest"; + }; + + return CreateVpcFlowLogsConfigRequest; + })(); + + v1.UpdateVpcFlowLogsConfigRequest = (function() { + + /** + * Properties of an UpdateVpcFlowLogsConfigRequest. + * @memberof google.cloud.networkmanagement.v1 + * @interface IUpdateVpcFlowLogsConfigRequest + * @property {google.protobuf.IFieldMask|null} [updateMask] UpdateVpcFlowLogsConfigRequest updateMask + * @property {google.cloud.networkmanagement.v1.IVpcFlowLogsConfig|null} [vpcFlowLogsConfig] UpdateVpcFlowLogsConfigRequest vpcFlowLogsConfig + */ + + /** + * Constructs a new UpdateVpcFlowLogsConfigRequest. + * @memberof google.cloud.networkmanagement.v1 + * @classdesc Represents an UpdateVpcFlowLogsConfigRequest. + * @implements IUpdateVpcFlowLogsConfigRequest + * @constructor + * @param {google.cloud.networkmanagement.v1.IUpdateVpcFlowLogsConfigRequest=} [properties] Properties to set + */ + function UpdateVpcFlowLogsConfigRequest(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]]; + } + + /** + * UpdateVpcFlowLogsConfigRequest updateMask. + * @member {google.protobuf.IFieldMask|null|undefined} updateMask + * @memberof google.cloud.networkmanagement.v1.UpdateVpcFlowLogsConfigRequest + * @instance + */ + UpdateVpcFlowLogsConfigRequest.prototype.updateMask = null; + + /** + * UpdateVpcFlowLogsConfigRequest vpcFlowLogsConfig. + * @member {google.cloud.networkmanagement.v1.IVpcFlowLogsConfig|null|undefined} vpcFlowLogsConfig + * @memberof google.cloud.networkmanagement.v1.UpdateVpcFlowLogsConfigRequest + * @instance + */ + UpdateVpcFlowLogsConfigRequest.prototype.vpcFlowLogsConfig = null; + + /** + * Creates a new UpdateVpcFlowLogsConfigRequest instance using the specified properties. + * @function create + * @memberof google.cloud.networkmanagement.v1.UpdateVpcFlowLogsConfigRequest + * @static + * @param {google.cloud.networkmanagement.v1.IUpdateVpcFlowLogsConfigRequest=} [properties] Properties to set + * @returns {google.cloud.networkmanagement.v1.UpdateVpcFlowLogsConfigRequest} UpdateVpcFlowLogsConfigRequest instance + */ + UpdateVpcFlowLogsConfigRequest.create = function create(properties) { + return new UpdateVpcFlowLogsConfigRequest(properties); + }; + + /** + * Encodes the specified UpdateVpcFlowLogsConfigRequest message. Does not implicitly {@link google.cloud.networkmanagement.v1.UpdateVpcFlowLogsConfigRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.networkmanagement.v1.UpdateVpcFlowLogsConfigRequest + * @static + * @param {google.cloud.networkmanagement.v1.IUpdateVpcFlowLogsConfigRequest} message UpdateVpcFlowLogsConfigRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UpdateVpcFlowLogsConfigRequest.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.vpcFlowLogsConfig != null && Object.hasOwnProperty.call(message, "vpcFlowLogsConfig")) + $root.google.cloud.networkmanagement.v1.VpcFlowLogsConfig.encode(message.vpcFlowLogsConfig, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified UpdateVpcFlowLogsConfigRequest message, length delimited. Does not implicitly {@link google.cloud.networkmanagement.v1.UpdateVpcFlowLogsConfigRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.networkmanagement.v1.UpdateVpcFlowLogsConfigRequest + * @static + * @param {google.cloud.networkmanagement.v1.IUpdateVpcFlowLogsConfigRequest} message UpdateVpcFlowLogsConfigRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UpdateVpcFlowLogsConfigRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an UpdateVpcFlowLogsConfigRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.networkmanagement.v1.UpdateVpcFlowLogsConfigRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.networkmanagement.v1.UpdateVpcFlowLogsConfigRequest} UpdateVpcFlowLogsConfigRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UpdateVpcFlowLogsConfigRequest.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.networkmanagement.v1.UpdateVpcFlowLogsConfigRequest(); + 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.vpcFlowLogsConfig = $root.google.cloud.networkmanagement.v1.VpcFlowLogsConfig.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an UpdateVpcFlowLogsConfigRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.networkmanagement.v1.UpdateVpcFlowLogsConfigRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.networkmanagement.v1.UpdateVpcFlowLogsConfigRequest} UpdateVpcFlowLogsConfigRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UpdateVpcFlowLogsConfigRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an UpdateVpcFlowLogsConfigRequest message. + * @function verify + * @memberof google.cloud.networkmanagement.v1.UpdateVpcFlowLogsConfigRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + UpdateVpcFlowLogsConfigRequest.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.vpcFlowLogsConfig != null && message.hasOwnProperty("vpcFlowLogsConfig")) { + var error = $root.google.cloud.networkmanagement.v1.VpcFlowLogsConfig.verify(message.vpcFlowLogsConfig); + if (error) + return "vpcFlowLogsConfig." + error; + } + return null; + }; + + /** + * Creates an UpdateVpcFlowLogsConfigRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.networkmanagement.v1.UpdateVpcFlowLogsConfigRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.networkmanagement.v1.UpdateVpcFlowLogsConfigRequest} UpdateVpcFlowLogsConfigRequest + */ + UpdateVpcFlowLogsConfigRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.networkmanagement.v1.UpdateVpcFlowLogsConfigRequest) + return object; + var message = new $root.google.cloud.networkmanagement.v1.UpdateVpcFlowLogsConfigRequest(); + if (object.updateMask != null) { + if (typeof object.updateMask !== "object") + throw TypeError(".google.cloud.networkmanagement.v1.UpdateVpcFlowLogsConfigRequest.updateMask: object expected"); + message.updateMask = $root.google.protobuf.FieldMask.fromObject(object.updateMask); + } + if (object.vpcFlowLogsConfig != null) { + if (typeof object.vpcFlowLogsConfig !== "object") + throw TypeError(".google.cloud.networkmanagement.v1.UpdateVpcFlowLogsConfigRequest.vpcFlowLogsConfig: object expected"); + message.vpcFlowLogsConfig = $root.google.cloud.networkmanagement.v1.VpcFlowLogsConfig.fromObject(object.vpcFlowLogsConfig); + } + return message; + }; + + /** + * Creates a plain object from an UpdateVpcFlowLogsConfigRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.networkmanagement.v1.UpdateVpcFlowLogsConfigRequest + * @static + * @param {google.cloud.networkmanagement.v1.UpdateVpcFlowLogsConfigRequest} message UpdateVpcFlowLogsConfigRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + UpdateVpcFlowLogsConfigRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.updateMask = null; + object.vpcFlowLogsConfig = null; + } + if (message.updateMask != null && message.hasOwnProperty("updateMask")) + object.updateMask = $root.google.protobuf.FieldMask.toObject(message.updateMask, options); + if (message.vpcFlowLogsConfig != null && message.hasOwnProperty("vpcFlowLogsConfig")) + object.vpcFlowLogsConfig = $root.google.cloud.networkmanagement.v1.VpcFlowLogsConfig.toObject(message.vpcFlowLogsConfig, options); + return object; + }; + + /** + * Converts this UpdateVpcFlowLogsConfigRequest to JSON. + * @function toJSON + * @memberof google.cloud.networkmanagement.v1.UpdateVpcFlowLogsConfigRequest + * @instance + * @returns {Object.} JSON object + */ + UpdateVpcFlowLogsConfigRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for UpdateVpcFlowLogsConfigRequest + * @function getTypeUrl + * @memberof google.cloud.networkmanagement.v1.UpdateVpcFlowLogsConfigRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + UpdateVpcFlowLogsConfigRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.networkmanagement.v1.UpdateVpcFlowLogsConfigRequest"; + }; + + return UpdateVpcFlowLogsConfigRequest; + })(); + + v1.DeleteVpcFlowLogsConfigRequest = (function() { + + /** + * Properties of a DeleteVpcFlowLogsConfigRequest. + * @memberof google.cloud.networkmanagement.v1 + * @interface IDeleteVpcFlowLogsConfigRequest + * @property {string|null} [name] DeleteVpcFlowLogsConfigRequest name + */ + + /** + * Constructs a new DeleteVpcFlowLogsConfigRequest. + * @memberof google.cloud.networkmanagement.v1 + * @classdesc Represents a DeleteVpcFlowLogsConfigRequest. + * @implements IDeleteVpcFlowLogsConfigRequest + * @constructor + * @param {google.cloud.networkmanagement.v1.IDeleteVpcFlowLogsConfigRequest=} [properties] Properties to set + */ + function DeleteVpcFlowLogsConfigRequest(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]]; + } + + /** + * DeleteVpcFlowLogsConfigRequest name. + * @member {string} name + * @memberof google.cloud.networkmanagement.v1.DeleteVpcFlowLogsConfigRequest + * @instance + */ + DeleteVpcFlowLogsConfigRequest.prototype.name = ""; + + /** + * Creates a new DeleteVpcFlowLogsConfigRequest instance using the specified properties. + * @function create + * @memberof google.cloud.networkmanagement.v1.DeleteVpcFlowLogsConfigRequest + * @static + * @param {google.cloud.networkmanagement.v1.IDeleteVpcFlowLogsConfigRequest=} [properties] Properties to set + * @returns {google.cloud.networkmanagement.v1.DeleteVpcFlowLogsConfigRequest} DeleteVpcFlowLogsConfigRequest instance + */ + DeleteVpcFlowLogsConfigRequest.create = function create(properties) { + return new DeleteVpcFlowLogsConfigRequest(properties); + }; + + /** + * Encodes the specified DeleteVpcFlowLogsConfigRequest message. Does not implicitly {@link google.cloud.networkmanagement.v1.DeleteVpcFlowLogsConfigRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.networkmanagement.v1.DeleteVpcFlowLogsConfigRequest + * @static + * @param {google.cloud.networkmanagement.v1.IDeleteVpcFlowLogsConfigRequest} message DeleteVpcFlowLogsConfigRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeleteVpcFlowLogsConfigRequest.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 DeleteVpcFlowLogsConfigRequest message, length delimited. Does not implicitly {@link google.cloud.networkmanagement.v1.DeleteVpcFlowLogsConfigRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.networkmanagement.v1.DeleteVpcFlowLogsConfigRequest + * @static + * @param {google.cloud.networkmanagement.v1.IDeleteVpcFlowLogsConfigRequest} message DeleteVpcFlowLogsConfigRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeleteVpcFlowLogsConfigRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DeleteVpcFlowLogsConfigRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.networkmanagement.v1.DeleteVpcFlowLogsConfigRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.networkmanagement.v1.DeleteVpcFlowLogsConfigRequest} DeleteVpcFlowLogsConfigRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeleteVpcFlowLogsConfigRequest.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.networkmanagement.v1.DeleteVpcFlowLogsConfigRequest(); + 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 DeleteVpcFlowLogsConfigRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.networkmanagement.v1.DeleteVpcFlowLogsConfigRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.networkmanagement.v1.DeleteVpcFlowLogsConfigRequest} DeleteVpcFlowLogsConfigRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeleteVpcFlowLogsConfigRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DeleteVpcFlowLogsConfigRequest message. + * @function verify + * @memberof google.cloud.networkmanagement.v1.DeleteVpcFlowLogsConfigRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DeleteVpcFlowLogsConfigRequest.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 DeleteVpcFlowLogsConfigRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.networkmanagement.v1.DeleteVpcFlowLogsConfigRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.networkmanagement.v1.DeleteVpcFlowLogsConfigRequest} DeleteVpcFlowLogsConfigRequest + */ + DeleteVpcFlowLogsConfigRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.networkmanagement.v1.DeleteVpcFlowLogsConfigRequest) + return object; + var message = new $root.google.cloud.networkmanagement.v1.DeleteVpcFlowLogsConfigRequest(); + if (object.name != null) + message.name = String(object.name); + return message; + }; + + /** + * Creates a plain object from a DeleteVpcFlowLogsConfigRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.networkmanagement.v1.DeleteVpcFlowLogsConfigRequest + * @static + * @param {google.cloud.networkmanagement.v1.DeleteVpcFlowLogsConfigRequest} message DeleteVpcFlowLogsConfigRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DeleteVpcFlowLogsConfigRequest.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 DeleteVpcFlowLogsConfigRequest to JSON. + * @function toJSON + * @memberof google.cloud.networkmanagement.v1.DeleteVpcFlowLogsConfigRequest + * @instance + * @returns {Object.} JSON object + */ + DeleteVpcFlowLogsConfigRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for DeleteVpcFlowLogsConfigRequest + * @function getTypeUrl + * @memberof google.cloud.networkmanagement.v1.DeleteVpcFlowLogsConfigRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + DeleteVpcFlowLogsConfigRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.networkmanagement.v1.DeleteVpcFlowLogsConfigRequest"; + }; + + return DeleteVpcFlowLogsConfigRequest; + })(); + + v1.VpcFlowLogsConfig = (function() { + + /** + * Properties of a VpcFlowLogsConfig. + * @memberof google.cloud.networkmanagement.v1 + * @interface IVpcFlowLogsConfig + * @property {string|null} [name] VpcFlowLogsConfig name + * @property {string|null} [description] VpcFlowLogsConfig description + * @property {google.cloud.networkmanagement.v1.VpcFlowLogsConfig.State|null} [state] VpcFlowLogsConfig state + * @property {google.cloud.networkmanagement.v1.VpcFlowLogsConfig.AggregationInterval|null} [aggregationInterval] VpcFlowLogsConfig aggregationInterval + * @property {number|null} [flowSampling] VpcFlowLogsConfig flowSampling + * @property {google.cloud.networkmanagement.v1.VpcFlowLogsConfig.Metadata|null} [metadata] VpcFlowLogsConfig metadata + * @property {Array.|null} [metadataFields] VpcFlowLogsConfig metadataFields + * @property {string|null} [filterExpr] VpcFlowLogsConfig filterExpr + * @property {google.cloud.networkmanagement.v1.VpcFlowLogsConfig.TargetResourceState|null} [targetResourceState] VpcFlowLogsConfig targetResourceState + * @property {string|null} [interconnectAttachment] VpcFlowLogsConfig interconnectAttachment + * @property {string|null} [vpnTunnel] VpcFlowLogsConfig vpnTunnel + * @property {Object.|null} [labels] VpcFlowLogsConfig labels + * @property {google.protobuf.ITimestamp|null} [createTime] VpcFlowLogsConfig createTime + * @property {google.protobuf.ITimestamp|null} [updateTime] VpcFlowLogsConfig updateTime + */ + + /** + * Constructs a new VpcFlowLogsConfig. + * @memberof google.cloud.networkmanagement.v1 + * @classdesc Represents a VpcFlowLogsConfig. + * @implements IVpcFlowLogsConfig + * @constructor + * @param {google.cloud.networkmanagement.v1.IVpcFlowLogsConfig=} [properties] Properties to set + */ + function VpcFlowLogsConfig(properties) { + this.metadataFields = []; + 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]]; + } + + /** + * VpcFlowLogsConfig name. + * @member {string} name + * @memberof google.cloud.networkmanagement.v1.VpcFlowLogsConfig + * @instance + */ + VpcFlowLogsConfig.prototype.name = ""; + + /** + * VpcFlowLogsConfig description. + * @member {string|null|undefined} description + * @memberof google.cloud.networkmanagement.v1.VpcFlowLogsConfig + * @instance + */ + VpcFlowLogsConfig.prototype.description = null; + + /** + * VpcFlowLogsConfig state. + * @member {google.cloud.networkmanagement.v1.VpcFlowLogsConfig.State|null|undefined} state + * @memberof google.cloud.networkmanagement.v1.VpcFlowLogsConfig + * @instance + */ + VpcFlowLogsConfig.prototype.state = null; + + /** + * VpcFlowLogsConfig aggregationInterval. + * @member {google.cloud.networkmanagement.v1.VpcFlowLogsConfig.AggregationInterval|null|undefined} aggregationInterval + * @memberof google.cloud.networkmanagement.v1.VpcFlowLogsConfig + * @instance + */ + VpcFlowLogsConfig.prototype.aggregationInterval = null; + + /** + * VpcFlowLogsConfig flowSampling. + * @member {number|null|undefined} flowSampling + * @memberof google.cloud.networkmanagement.v1.VpcFlowLogsConfig + * @instance + */ + VpcFlowLogsConfig.prototype.flowSampling = null; + + /** + * VpcFlowLogsConfig metadata. + * @member {google.cloud.networkmanagement.v1.VpcFlowLogsConfig.Metadata|null|undefined} metadata + * @memberof google.cloud.networkmanagement.v1.VpcFlowLogsConfig + * @instance + */ + VpcFlowLogsConfig.prototype.metadata = null; + + /** + * VpcFlowLogsConfig metadataFields. + * @member {Array.} metadataFields + * @memberof google.cloud.networkmanagement.v1.VpcFlowLogsConfig + * @instance + */ + VpcFlowLogsConfig.prototype.metadataFields = $util.emptyArray; + + /** + * VpcFlowLogsConfig filterExpr. + * @member {string|null|undefined} filterExpr + * @memberof google.cloud.networkmanagement.v1.VpcFlowLogsConfig + * @instance + */ + VpcFlowLogsConfig.prototype.filterExpr = null; + + /** + * VpcFlowLogsConfig targetResourceState. + * @member {google.cloud.networkmanagement.v1.VpcFlowLogsConfig.TargetResourceState|null|undefined} targetResourceState + * @memberof google.cloud.networkmanagement.v1.VpcFlowLogsConfig + * @instance + */ + VpcFlowLogsConfig.prototype.targetResourceState = null; + + /** + * VpcFlowLogsConfig interconnectAttachment. + * @member {string|null|undefined} interconnectAttachment + * @memberof google.cloud.networkmanagement.v1.VpcFlowLogsConfig + * @instance + */ + VpcFlowLogsConfig.prototype.interconnectAttachment = null; + + /** + * VpcFlowLogsConfig vpnTunnel. + * @member {string|null|undefined} vpnTunnel + * @memberof google.cloud.networkmanagement.v1.VpcFlowLogsConfig + * @instance + */ + VpcFlowLogsConfig.prototype.vpnTunnel = null; + + /** + * VpcFlowLogsConfig labels. + * @member {Object.} labels + * @memberof google.cloud.networkmanagement.v1.VpcFlowLogsConfig + * @instance + */ + VpcFlowLogsConfig.prototype.labels = $util.emptyObject; + + /** + * VpcFlowLogsConfig createTime. + * @member {google.protobuf.ITimestamp|null|undefined} createTime + * @memberof google.cloud.networkmanagement.v1.VpcFlowLogsConfig + * @instance + */ + VpcFlowLogsConfig.prototype.createTime = null; + + /** + * VpcFlowLogsConfig updateTime. + * @member {google.protobuf.ITimestamp|null|undefined} updateTime + * @memberof google.cloud.networkmanagement.v1.VpcFlowLogsConfig + * @instance + */ + VpcFlowLogsConfig.prototype.updateTime = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * VpcFlowLogsConfig _description. + * @member {"description"|undefined} _description + * @memberof google.cloud.networkmanagement.v1.VpcFlowLogsConfig + * @instance + */ + Object.defineProperty(VpcFlowLogsConfig.prototype, "_description", { + get: $util.oneOfGetter($oneOfFields = ["description"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * VpcFlowLogsConfig _state. + * @member {"state"|undefined} _state + * @memberof google.cloud.networkmanagement.v1.VpcFlowLogsConfig + * @instance + */ + Object.defineProperty(VpcFlowLogsConfig.prototype, "_state", { + get: $util.oneOfGetter($oneOfFields = ["state"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * VpcFlowLogsConfig _aggregationInterval. + * @member {"aggregationInterval"|undefined} _aggregationInterval + * @memberof google.cloud.networkmanagement.v1.VpcFlowLogsConfig + * @instance + */ + Object.defineProperty(VpcFlowLogsConfig.prototype, "_aggregationInterval", { + get: $util.oneOfGetter($oneOfFields = ["aggregationInterval"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * VpcFlowLogsConfig _flowSampling. + * @member {"flowSampling"|undefined} _flowSampling + * @memberof google.cloud.networkmanagement.v1.VpcFlowLogsConfig + * @instance + */ + Object.defineProperty(VpcFlowLogsConfig.prototype, "_flowSampling", { + get: $util.oneOfGetter($oneOfFields = ["flowSampling"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * VpcFlowLogsConfig _metadata. + * @member {"metadata"|undefined} _metadata + * @memberof google.cloud.networkmanagement.v1.VpcFlowLogsConfig + * @instance + */ + Object.defineProperty(VpcFlowLogsConfig.prototype, "_metadata", { + get: $util.oneOfGetter($oneOfFields = ["metadata"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * VpcFlowLogsConfig _filterExpr. + * @member {"filterExpr"|undefined} _filterExpr + * @memberof google.cloud.networkmanagement.v1.VpcFlowLogsConfig + * @instance + */ + Object.defineProperty(VpcFlowLogsConfig.prototype, "_filterExpr", { + get: $util.oneOfGetter($oneOfFields = ["filterExpr"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * VpcFlowLogsConfig _targetResourceState. + * @member {"targetResourceState"|undefined} _targetResourceState + * @memberof google.cloud.networkmanagement.v1.VpcFlowLogsConfig + * @instance + */ + Object.defineProperty(VpcFlowLogsConfig.prototype, "_targetResourceState", { + get: $util.oneOfGetter($oneOfFields = ["targetResourceState"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * VpcFlowLogsConfig targetResource. + * @member {"interconnectAttachment"|"vpnTunnel"|undefined} targetResource + * @memberof google.cloud.networkmanagement.v1.VpcFlowLogsConfig + * @instance + */ + Object.defineProperty(VpcFlowLogsConfig.prototype, "targetResource", { + get: $util.oneOfGetter($oneOfFields = ["interconnectAttachment", "vpnTunnel"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new VpcFlowLogsConfig instance using the specified properties. + * @function create + * @memberof google.cloud.networkmanagement.v1.VpcFlowLogsConfig + * @static + * @param {google.cloud.networkmanagement.v1.IVpcFlowLogsConfig=} [properties] Properties to set + * @returns {google.cloud.networkmanagement.v1.VpcFlowLogsConfig} VpcFlowLogsConfig instance + */ + VpcFlowLogsConfig.create = function create(properties) { + return new VpcFlowLogsConfig(properties); + }; + + /** + * Encodes the specified VpcFlowLogsConfig message. Does not implicitly {@link google.cloud.networkmanagement.v1.VpcFlowLogsConfig.verify|verify} messages. + * @function encode + * @memberof google.cloud.networkmanagement.v1.VpcFlowLogsConfig + * @static + * @param {google.cloud.networkmanagement.v1.IVpcFlowLogsConfig} message VpcFlowLogsConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + VpcFlowLogsConfig.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.description != null && Object.hasOwnProperty.call(message, "description")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.description); + if (message.state != null && Object.hasOwnProperty.call(message, "state")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.state); + if (message.aggregationInterval != null && Object.hasOwnProperty.call(message, "aggregationInterval")) + writer.uint32(/* id 4, wireType 0 =*/32).int32(message.aggregationInterval); + if (message.flowSampling != null && Object.hasOwnProperty.call(message, "flowSampling")) + writer.uint32(/* id 5, wireType 5 =*/45).float(message.flowSampling); + if (message.metadata != null && Object.hasOwnProperty.call(message, "metadata")) + writer.uint32(/* id 6, wireType 0 =*/48).int32(message.metadata); + if (message.metadataFields != null && message.metadataFields.length) + for (var i = 0; i < message.metadataFields.length; ++i) + writer.uint32(/* id 7, wireType 2 =*/58).string(message.metadataFields[i]); + if (message.filterExpr != null && Object.hasOwnProperty.call(message, "filterExpr")) + writer.uint32(/* id 8, wireType 2 =*/66).string(message.filterExpr); + if (message.createTime != null && Object.hasOwnProperty.call(message, "createTime")) + $root.google.protobuf.Timestamp.encode(message.createTime, writer.uint32(/* id 9, wireType 2 =*/74).fork()).ldelim(); + if (message.updateTime != null && Object.hasOwnProperty.call(message, "updateTime")) + $root.google.protobuf.Timestamp.encode(message.updateTime, writer.uint32(/* id 10, wireType 2 =*/82).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 11, wireType 2 =*/90).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]).uint32(/* id 2, wireType 2 =*/18).string(message.labels[keys[i]]).ldelim(); + if (message.targetResourceState != null && Object.hasOwnProperty.call(message, "targetResourceState")) + writer.uint32(/* id 12, wireType 0 =*/96).int32(message.targetResourceState); + if (message.interconnectAttachment != null && Object.hasOwnProperty.call(message, "interconnectAttachment")) + writer.uint32(/* id 102, wireType 2 =*/818).string(message.interconnectAttachment); + if (message.vpnTunnel != null && Object.hasOwnProperty.call(message, "vpnTunnel")) + writer.uint32(/* id 103, wireType 2 =*/826).string(message.vpnTunnel); + return writer; + }; + + /** + * Encodes the specified VpcFlowLogsConfig message, length delimited. Does not implicitly {@link google.cloud.networkmanagement.v1.VpcFlowLogsConfig.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.networkmanagement.v1.VpcFlowLogsConfig + * @static + * @param {google.cloud.networkmanagement.v1.IVpcFlowLogsConfig} message VpcFlowLogsConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + VpcFlowLogsConfig.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a VpcFlowLogsConfig message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.networkmanagement.v1.VpcFlowLogsConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.networkmanagement.v1.VpcFlowLogsConfig} VpcFlowLogsConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + VpcFlowLogsConfig.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.networkmanagement.v1.VpcFlowLogsConfig(), key, value; + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + case 2: { + message.description = reader.string(); + break; + } + case 3: { + message.state = reader.int32(); + break; + } + case 4: { + message.aggregationInterval = reader.int32(); + break; + } + case 5: { + message.flowSampling = reader.float(); + break; + } + case 6: { + message.metadata = reader.int32(); + break; + } + case 7: { + if (!(message.metadataFields && message.metadataFields.length)) + message.metadataFields = []; + message.metadataFields.push(reader.string()); + break; + } + case 8: { + message.filterExpr = reader.string(); + break; + } + case 12: { + message.targetResourceState = reader.int32(); + break; + } + case 102: { + message.interconnectAttachment = reader.string(); + break; + } + case 103: { + message.vpnTunnel = reader.string(); + break; + } + case 11: { + 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 9: { + message.createTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + case 10: { + message.updateTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a VpcFlowLogsConfig message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.networkmanagement.v1.VpcFlowLogsConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.networkmanagement.v1.VpcFlowLogsConfig} VpcFlowLogsConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + VpcFlowLogsConfig.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a VpcFlowLogsConfig message. + * @function verify + * @memberof google.cloud.networkmanagement.v1.VpcFlowLogsConfig + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + VpcFlowLogsConfig.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.description != null && message.hasOwnProperty("description")) { + properties._description = 1; + if (!$util.isString(message.description)) + return "description: string expected"; + } + if (message.state != null && message.hasOwnProperty("state")) { + properties._state = 1; + switch (message.state) { + default: + return "state: enum value expected"; + case 0: + case 1: + case 2: + break; + } + } + if (message.aggregationInterval != null && message.hasOwnProperty("aggregationInterval")) { + properties._aggregationInterval = 1; + switch (message.aggregationInterval) { + default: + return "aggregationInterval: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + break; + } + } + if (message.flowSampling != null && message.hasOwnProperty("flowSampling")) { + properties._flowSampling = 1; + if (typeof message.flowSampling !== "number") + return "flowSampling: number expected"; + } + if (message.metadata != null && message.hasOwnProperty("metadata")) { + properties._metadata = 1; + switch (message.metadata) { + default: + return "metadata: enum value expected"; + case 0: + case 1: + case 2: + case 3: + break; + } + } + if (message.metadataFields != null && message.hasOwnProperty("metadataFields")) { + if (!Array.isArray(message.metadataFields)) + return "metadataFields: array expected"; + for (var i = 0; i < message.metadataFields.length; ++i) + if (!$util.isString(message.metadataFields[i])) + return "metadataFields: string[] expected"; + } + if (message.filterExpr != null && message.hasOwnProperty("filterExpr")) { + properties._filterExpr = 1; + if (!$util.isString(message.filterExpr)) + return "filterExpr: string expected"; + } + if (message.targetResourceState != null && message.hasOwnProperty("targetResourceState")) { + properties._targetResourceState = 1; + switch (message.targetResourceState) { + default: + return "targetResourceState: enum value expected"; + case 0: + case 1: + case 2: + break; + } + } + if (message.interconnectAttachment != null && message.hasOwnProperty("interconnectAttachment")) { + properties.targetResource = 1; + if (!$util.isString(message.interconnectAttachment)) + return "interconnectAttachment: string expected"; + } + if (message.vpnTunnel != null && message.hasOwnProperty("vpnTunnel")) { + if (properties.targetResource === 1) + return "targetResource: multiple values"; + properties.targetResource = 1; + if (!$util.isString(message.vpnTunnel)) + return "vpnTunnel: string expected"; + } + 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.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; + } + return null; + }; + + /** + * Creates a VpcFlowLogsConfig message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.networkmanagement.v1.VpcFlowLogsConfig + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.networkmanagement.v1.VpcFlowLogsConfig} VpcFlowLogsConfig + */ + VpcFlowLogsConfig.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.networkmanagement.v1.VpcFlowLogsConfig) + return object; + var message = new $root.google.cloud.networkmanagement.v1.VpcFlowLogsConfig(); + if (object.name != null) + message.name = String(object.name); + if (object.description != null) + message.description = String(object.description); + switch (object.state) { + default: + if (typeof object.state === "number") { + message.state = object.state; + break; + } + break; + case "STATE_UNSPECIFIED": + case 0: + message.state = 0; + break; + case "ENABLED": + case 1: + message.state = 1; + break; + case "DISABLED": + case 2: + message.state = 2; + break; + } + switch (object.aggregationInterval) { + default: + if (typeof object.aggregationInterval === "number") { + message.aggregationInterval = object.aggregationInterval; + break; + } + break; + case "AGGREGATION_INTERVAL_UNSPECIFIED": + case 0: + message.aggregationInterval = 0; + break; + case "INTERVAL_5_SEC": + case 1: + message.aggregationInterval = 1; + break; + case "INTERVAL_30_SEC": + case 2: + message.aggregationInterval = 2; + break; + case "INTERVAL_1_MIN": + case 3: + message.aggregationInterval = 3; + break; + case "INTERVAL_5_MIN": + case 4: + message.aggregationInterval = 4; + break; + case "INTERVAL_10_MIN": + case 5: + message.aggregationInterval = 5; + break; + case "INTERVAL_15_MIN": + case 6: + message.aggregationInterval = 6; + break; + } + if (object.flowSampling != null) + message.flowSampling = Number(object.flowSampling); + switch (object.metadata) { + default: + if (typeof object.metadata === "number") { + message.metadata = object.metadata; + break; + } + break; + case "METADATA_UNSPECIFIED": + case 0: + message.metadata = 0; + break; + case "INCLUDE_ALL_METADATA": + case 1: + message.metadata = 1; + break; + case "EXCLUDE_ALL_METADATA": + case 2: + message.metadata = 2; + break; + case "CUSTOM_METADATA": + case 3: + message.metadata = 3; + break; + } + if (object.metadataFields) { + if (!Array.isArray(object.metadataFields)) + throw TypeError(".google.cloud.networkmanagement.v1.VpcFlowLogsConfig.metadataFields: array expected"); + message.metadataFields = []; + for (var i = 0; i < object.metadataFields.length; ++i) + message.metadataFields[i] = String(object.metadataFields[i]); + } + if (object.filterExpr != null) + message.filterExpr = String(object.filterExpr); + switch (object.targetResourceState) { + default: + if (typeof object.targetResourceState === "number") { + message.targetResourceState = object.targetResourceState; + break; + } + break; + case "TARGET_RESOURCE_STATE_UNSPECIFIED": + case 0: + message.targetResourceState = 0; + break; + case "TARGET_RESOURCE_EXISTS": + case 1: + message.targetResourceState = 1; + break; + case "TARGET_RESOURCE_DOES_NOT_EXIST": + case 2: + message.targetResourceState = 2; + break; + } + if (object.interconnectAttachment != null) + message.interconnectAttachment = String(object.interconnectAttachment); + if (object.vpnTunnel != null) + message.vpnTunnel = String(object.vpnTunnel); + if (object.labels) { + if (typeof object.labels !== "object") + throw TypeError(".google.cloud.networkmanagement.v1.VpcFlowLogsConfig.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.createTime != null) { + if (typeof object.createTime !== "object") + throw TypeError(".google.cloud.networkmanagement.v1.VpcFlowLogsConfig.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.networkmanagement.v1.VpcFlowLogsConfig.updateTime: object expected"); + message.updateTime = $root.google.protobuf.Timestamp.fromObject(object.updateTime); + } + return message; + }; + + /** + * Creates a plain object from a VpcFlowLogsConfig message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.networkmanagement.v1.VpcFlowLogsConfig + * @static + * @param {google.cloud.networkmanagement.v1.VpcFlowLogsConfig} message VpcFlowLogsConfig + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + VpcFlowLogsConfig.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.metadataFields = []; + if (options.objects || options.defaults) + object.labels = {}; + if (options.defaults) { + object.name = ""; + object.createTime = null; + object.updateTime = null; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.description != null && message.hasOwnProperty("description")) { + object.description = message.description; + if (options.oneofs) + object._description = "description"; + } + if (message.state != null && message.hasOwnProperty("state")) { + object.state = options.enums === String ? $root.google.cloud.networkmanagement.v1.VpcFlowLogsConfig.State[message.state] === undefined ? message.state : $root.google.cloud.networkmanagement.v1.VpcFlowLogsConfig.State[message.state] : message.state; + if (options.oneofs) + object._state = "state"; + } + if (message.aggregationInterval != null && message.hasOwnProperty("aggregationInterval")) { + object.aggregationInterval = options.enums === String ? $root.google.cloud.networkmanagement.v1.VpcFlowLogsConfig.AggregationInterval[message.aggregationInterval] === undefined ? message.aggregationInterval : $root.google.cloud.networkmanagement.v1.VpcFlowLogsConfig.AggregationInterval[message.aggregationInterval] : message.aggregationInterval; + if (options.oneofs) + object._aggregationInterval = "aggregationInterval"; + } + if (message.flowSampling != null && message.hasOwnProperty("flowSampling")) { + object.flowSampling = options.json && !isFinite(message.flowSampling) ? String(message.flowSampling) : message.flowSampling; + if (options.oneofs) + object._flowSampling = "flowSampling"; + } + if (message.metadata != null && message.hasOwnProperty("metadata")) { + object.metadata = options.enums === String ? $root.google.cloud.networkmanagement.v1.VpcFlowLogsConfig.Metadata[message.metadata] === undefined ? message.metadata : $root.google.cloud.networkmanagement.v1.VpcFlowLogsConfig.Metadata[message.metadata] : message.metadata; + if (options.oneofs) + object._metadata = "metadata"; + } + if (message.metadataFields && message.metadataFields.length) { + object.metadataFields = []; + for (var j = 0; j < message.metadataFields.length; ++j) + object.metadataFields[j] = message.metadataFields[j]; + } + if (message.filterExpr != null && message.hasOwnProperty("filterExpr")) { + object.filterExpr = message.filterExpr; + if (options.oneofs) + object._filterExpr = "filterExpr"; + } + 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.targetResourceState != null && message.hasOwnProperty("targetResourceState")) { + object.targetResourceState = options.enums === String ? $root.google.cloud.networkmanagement.v1.VpcFlowLogsConfig.TargetResourceState[message.targetResourceState] === undefined ? message.targetResourceState : $root.google.cloud.networkmanagement.v1.VpcFlowLogsConfig.TargetResourceState[message.targetResourceState] : message.targetResourceState; + if (options.oneofs) + object._targetResourceState = "targetResourceState"; + } + if (message.interconnectAttachment != null && message.hasOwnProperty("interconnectAttachment")) { + object.interconnectAttachment = message.interconnectAttachment; + if (options.oneofs) + object.targetResource = "interconnectAttachment"; + } + if (message.vpnTunnel != null && message.hasOwnProperty("vpnTunnel")) { + object.vpnTunnel = message.vpnTunnel; + if (options.oneofs) + object.targetResource = "vpnTunnel"; + } + return object; + }; + + /** + * Converts this VpcFlowLogsConfig to JSON. + * @function toJSON + * @memberof google.cloud.networkmanagement.v1.VpcFlowLogsConfig + * @instance + * @returns {Object.} JSON object + */ + VpcFlowLogsConfig.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for VpcFlowLogsConfig + * @function getTypeUrl + * @memberof google.cloud.networkmanagement.v1.VpcFlowLogsConfig + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + VpcFlowLogsConfig.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.networkmanagement.v1.VpcFlowLogsConfig"; + }; + + /** + * State enum. + * @name google.cloud.networkmanagement.v1.VpcFlowLogsConfig.State + * @enum {number} + * @property {number} STATE_UNSPECIFIED=0 STATE_UNSPECIFIED value + * @property {number} ENABLED=1 ENABLED value + * @property {number} DISABLED=2 DISABLED value + */ + VpcFlowLogsConfig.State = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "STATE_UNSPECIFIED"] = 0; + values[valuesById[1] = "ENABLED"] = 1; + values[valuesById[2] = "DISABLED"] = 2; + return values; + })(); + + /** + * AggregationInterval enum. + * @name google.cloud.networkmanagement.v1.VpcFlowLogsConfig.AggregationInterval + * @enum {number} + * @property {number} AGGREGATION_INTERVAL_UNSPECIFIED=0 AGGREGATION_INTERVAL_UNSPECIFIED value + * @property {number} INTERVAL_5_SEC=1 INTERVAL_5_SEC value + * @property {number} INTERVAL_30_SEC=2 INTERVAL_30_SEC value + * @property {number} INTERVAL_1_MIN=3 INTERVAL_1_MIN value + * @property {number} INTERVAL_5_MIN=4 INTERVAL_5_MIN value + * @property {number} INTERVAL_10_MIN=5 INTERVAL_10_MIN value + * @property {number} INTERVAL_15_MIN=6 INTERVAL_15_MIN value + */ + VpcFlowLogsConfig.AggregationInterval = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "AGGREGATION_INTERVAL_UNSPECIFIED"] = 0; + values[valuesById[1] = "INTERVAL_5_SEC"] = 1; + values[valuesById[2] = "INTERVAL_30_SEC"] = 2; + values[valuesById[3] = "INTERVAL_1_MIN"] = 3; + values[valuesById[4] = "INTERVAL_5_MIN"] = 4; + values[valuesById[5] = "INTERVAL_10_MIN"] = 5; + values[valuesById[6] = "INTERVAL_15_MIN"] = 6; + return values; + })(); + + /** + * Metadata enum. + * @name google.cloud.networkmanagement.v1.VpcFlowLogsConfig.Metadata + * @enum {number} + * @property {number} METADATA_UNSPECIFIED=0 METADATA_UNSPECIFIED value + * @property {number} INCLUDE_ALL_METADATA=1 INCLUDE_ALL_METADATA value + * @property {number} EXCLUDE_ALL_METADATA=2 EXCLUDE_ALL_METADATA value + * @property {number} CUSTOM_METADATA=3 CUSTOM_METADATA value + */ + VpcFlowLogsConfig.Metadata = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "METADATA_UNSPECIFIED"] = 0; + values[valuesById[1] = "INCLUDE_ALL_METADATA"] = 1; + values[valuesById[2] = "EXCLUDE_ALL_METADATA"] = 2; + values[valuesById[3] = "CUSTOM_METADATA"] = 3; + return values; + })(); + + /** + * TargetResourceState enum. + * @name google.cloud.networkmanagement.v1.VpcFlowLogsConfig.TargetResourceState + * @enum {number} + * @property {number} TARGET_RESOURCE_STATE_UNSPECIFIED=0 TARGET_RESOURCE_STATE_UNSPECIFIED value + * @property {number} TARGET_RESOURCE_EXISTS=1 TARGET_RESOURCE_EXISTS value + * @property {number} TARGET_RESOURCE_DOES_NOT_EXIST=2 TARGET_RESOURCE_DOES_NOT_EXIST value + */ + VpcFlowLogsConfig.TargetResourceState = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "TARGET_RESOURCE_STATE_UNSPECIFIED"] = 0; + values[valuesById[1] = "TARGET_RESOURCE_EXISTS"] = 1; + values[valuesById[2] = "TARGET_RESOURCE_DOES_NOT_EXIST"] = 2; + return values; + })(); + + return VpcFlowLogsConfig; + })(); + return v1; })(); diff --git a/packages/google-cloud-networkmanagement/protos/protos.json b/packages/google-cloud-networkmanagement/protos/protos.json index 31186cbeedf..885740943c2 100644 --- a/packages/google-cloud-networkmanagement/protos/protos.json +++ b/packages/google-cloud-networkmanagement/protos/protos.json @@ -14,7 +14,7 @@ "csharp_namespace": "Google.Cloud.NetworkManagement.V1", "go_package": "cloud.google.com/go/networkmanagement/apiv1/networkmanagementpb;networkmanagementpb", "java_multiple_files": true, - "java_outer_classname": "ReachabilityServiceProto", + "java_outer_classname": "VpcFlowLogsConfigProto", "java_package": "com.google.cloud.networkmanagement.v1", "php_namespace": "Google\\Cloud\\NetworkManagement\\V1", "ruby_package": "Google::Cloud::NetworkManagement::V1" @@ -2173,6 +2173,448 @@ "id": 7 } } + }, + "VpcFlowLogsService": { + "options": { + "(google.api.default_host)": "networkmanagement.googleapis.com", + "(google.api.oauth_scopes)": "https://www.googleapis.com/auth/cloud-platform" + }, + "methods": { + "ListVpcFlowLogsConfigs": { + "requestType": "ListVpcFlowLogsConfigsRequest", + "responseType": "ListVpcFlowLogsConfigsResponse", + "options": { + "(google.api.http).get": "/v1/{parent=projects/*/locations/*}/vpcFlowLogsConfigs", + "(google.api.method_signature)": "parent" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v1/{parent=projects/*/locations/*}/vpcFlowLogsConfigs" + } + }, + { + "(google.api.method_signature)": "parent" + } + ] + }, + "GetVpcFlowLogsConfig": { + "requestType": "GetVpcFlowLogsConfigRequest", + "responseType": "VpcFlowLogsConfig", + "options": { + "(google.api.http).get": "/v1/{name=projects/*/locations/*/vpcFlowLogsConfigs/*}", + "(google.api.method_signature)": "name" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v1/{name=projects/*/locations/*/vpcFlowLogsConfigs/*}" + } + }, + { + "(google.api.method_signature)": "name" + } + ] + }, + "CreateVpcFlowLogsConfig": { + "requestType": "CreateVpcFlowLogsConfigRequest", + "responseType": "google.longrunning.Operation", + "options": { + "(google.api.http).post": "/v1/{parent=projects/*/locations/*}/vpcFlowLogsConfigs", + "(google.api.http).body": "vpc_flow_logs_config", + "(google.api.method_signature)": "parent,vpc_flow_logs_config,vpc_flow_logs_config_id", + "(google.longrunning.operation_info).response_type": "VpcFlowLogsConfig", + "(google.longrunning.operation_info).metadata_type": "google.cloud.networkmanagement.v1.OperationMetadata" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v1/{parent=projects/*/locations/*}/vpcFlowLogsConfigs", + "body": "vpc_flow_logs_config" + } + }, + { + "(google.api.method_signature)": "parent,vpc_flow_logs_config,vpc_flow_logs_config_id" + }, + { + "(google.longrunning.operation_info)": { + "response_type": "VpcFlowLogsConfig", + "metadata_type": "google.cloud.networkmanagement.v1.OperationMetadata" + } + } + ] + }, + "UpdateVpcFlowLogsConfig": { + "requestType": "UpdateVpcFlowLogsConfigRequest", + "responseType": "google.longrunning.Operation", + "options": { + "(google.api.http).patch": "/v1/{vpc_flow_logs_config.name=projects/*/locations/*/vpcFlowLogsConfigs/*}", + "(google.api.http).body": "vpc_flow_logs_config", + "(google.api.method_signature)": "vpc_flow_logs_config,update_mask", + "(google.longrunning.operation_info).response_type": "VpcFlowLogsConfig", + "(google.longrunning.operation_info).metadata_type": "google.cloud.networkmanagement.v1.OperationMetadata" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "patch": "/v1/{vpc_flow_logs_config.name=projects/*/locations/*/vpcFlowLogsConfigs/*}", + "body": "vpc_flow_logs_config" + } + }, + { + "(google.api.method_signature)": "vpc_flow_logs_config,update_mask" + }, + { + "(google.longrunning.operation_info)": { + "response_type": "VpcFlowLogsConfig", + "metadata_type": "google.cloud.networkmanagement.v1.OperationMetadata" + } + } + ] + }, + "DeleteVpcFlowLogsConfig": { + "requestType": "DeleteVpcFlowLogsConfigRequest", + "responseType": "google.longrunning.Operation", + "options": { + "(google.api.http).delete": "/v1/{name=projects/*/locations/*/vpcFlowLogsConfigs/*}", + "(google.api.method_signature)": "name", + "(google.longrunning.operation_info).response_type": "google.protobuf.Empty", + "(google.longrunning.operation_info).metadata_type": "google.cloud.networkmanagement.v1.OperationMetadata" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "delete": "/v1/{name=projects/*/locations/*/vpcFlowLogsConfigs/*}" + } + }, + { + "(google.api.method_signature)": "name" + }, + { + "(google.longrunning.operation_info)": { + "response_type": "google.protobuf.Empty", + "metadata_type": "google.cloud.networkmanagement.v1.OperationMetadata" + } + } + ] + } + } + }, + "ListVpcFlowLogsConfigsRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).child_type": "networkmanagement.googleapis.com/VpcFlowLogsConfig" + } + }, + "pageSize": { + "type": "int32", + "id": 2, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "pageToken": { + "type": "string", + "id": 3, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "filter": { + "type": "string", + "id": 4, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "orderBy": { + "type": "string", + "id": 5, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + } + }, + "ListVpcFlowLogsConfigsResponse": { + "fields": { + "vpcFlowLogsConfigs": { + "rule": "repeated", + "type": "VpcFlowLogsConfig", + "id": 1 + }, + "nextPageToken": { + "type": "string", + "id": 2 + }, + "unreachable": { + "rule": "repeated", + "type": "string", + "id": 3 + } + } + }, + "GetVpcFlowLogsConfigRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "networkmanagement.googleapis.com/VpcFlowLogsConfig" + } + } + } + }, + "CreateVpcFlowLogsConfigRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).child_type": "networkmanagement.googleapis.com/VpcFlowLogsConfig" + } + }, + "vpcFlowLogsConfigId": { + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "networkmanagement.googleapis.com/VpcFlowLogsConfig" + } + }, + "vpcFlowLogsConfig": { + "type": "VpcFlowLogsConfig", + "id": 3, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + } + } + }, + "UpdateVpcFlowLogsConfigRequest": { + "fields": { + "updateMask": { + "type": "google.protobuf.FieldMask", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "vpcFlowLogsConfig": { + "type": "VpcFlowLogsConfig", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + } + } + }, + "DeleteVpcFlowLogsConfigRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "networkmanagement.googleapis.com/VpcFlowLogsConfig" + } + } + } + }, + "VpcFlowLogsConfig": { + "options": { + "(google.api.resource).type": "networkmanagement.googleapis.com/VpcFlowLogsConfig", + "(google.api.resource).pattern": "projects/{project}/locations/{location}/vpcFlowLogsConfigs/{vpc_flow_logs_config}", + "(google.api.resource).plural": "vpcFlowLogsConfigs", + "(google.api.resource).singular": "vpcFlowLogsConfig" + }, + "oneofs": { + "_description": { + "oneof": [ + "description" + ] + }, + "_state": { + "oneof": [ + "state" + ] + }, + "_aggregationInterval": { + "oneof": [ + "aggregationInterval" + ] + }, + "_flowSampling": { + "oneof": [ + "flowSampling" + ] + }, + "_metadata": { + "oneof": [ + "metadata" + ] + }, + "_filterExpr": { + "oneof": [ + "filterExpr" + ] + }, + "_targetResourceState": { + "oneof": [ + "targetResourceState" + ] + }, + "targetResource": { + "oneof": [ + "interconnectAttachment", + "vpnTunnel" + ] + } + }, + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "IDENTIFIER" + } + }, + "description": { + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "OPTIONAL", + "proto3_optional": true + } + }, + "state": { + "type": "State", + "id": 3, + "options": { + "(google.api.field_behavior)": "OPTIONAL", + "proto3_optional": true + } + }, + "aggregationInterval": { + "type": "AggregationInterval", + "id": 4, + "options": { + "(google.api.field_behavior)": "OPTIONAL", + "proto3_optional": true + } + }, + "flowSampling": { + "type": "float", + "id": 5, + "options": { + "(google.api.field_behavior)": "OPTIONAL", + "proto3_optional": true + } + }, + "metadata": { + "type": "Metadata", + "id": 6, + "options": { + "(google.api.field_behavior)": "OPTIONAL", + "proto3_optional": true + } + }, + "metadataFields": { + "rule": "repeated", + "type": "string", + "id": 7, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "filterExpr": { + "type": "string", + "id": 8, + "options": { + "(google.api.field_behavior)": "OPTIONAL", + "proto3_optional": true + } + }, + "targetResourceState": { + "type": "TargetResourceState", + "id": 12, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY", + "proto3_optional": true + } + }, + "interconnectAttachment": { + "type": "string", + "id": 102 + }, + "vpnTunnel": { + "type": "string", + "id": 103 + }, + "labels": { + "keyType": "string", + "type": "string", + "id": 11, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "createTime": { + "type": "google.protobuf.Timestamp", + "id": 9, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "updateTime": { + "type": "google.protobuf.Timestamp", + "id": 10, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + } + }, + "nested": { + "State": { + "values": { + "STATE_UNSPECIFIED": 0, + "ENABLED": 1, + "DISABLED": 2 + } + }, + "AggregationInterval": { + "values": { + "AGGREGATION_INTERVAL_UNSPECIFIED": 0, + "INTERVAL_5_SEC": 1, + "INTERVAL_30_SEC": 2, + "INTERVAL_1_MIN": 3, + "INTERVAL_5_MIN": 4, + "INTERVAL_10_MIN": 5, + "INTERVAL_15_MIN": 6 + } + }, + "Metadata": { + "values": { + "METADATA_UNSPECIFIED": 0, + "INCLUDE_ALL_METADATA": 1, + "EXCLUDE_ALL_METADATA": 2, + "CUSTOM_METADATA": 3 + } + }, + "TargetResourceState": { + "values": { + "TARGET_RESOURCE_STATE_UNSPECIFIED": 0, + "TARGET_RESOURCE_EXISTS": 1, + "TARGET_RESOURCE_DOES_NOT_EXIST": 2 + } + } + } } } }, diff --git a/packages/google-cloud-networkmanagement/samples/README.md b/packages/google-cloud-networkmanagement/samples/README.md index 47349466b15..3f7708311a0 100644 --- a/packages/google-cloud-networkmanagement/samples/README.md +++ b/packages/google-cloud-networkmanagement/samples/README.md @@ -18,6 +18,11 @@ * [Reachability_service.list_connectivity_tests](#reachability_service.list_connectivity_tests) * [Reachability_service.rerun_connectivity_test](#reachability_service.rerun_connectivity_test) * [Reachability_service.update_connectivity_test](#reachability_service.update_connectivity_test) + * [Vpc_flow_logs_service.create_vpc_flow_logs_config](#vpc_flow_logs_service.create_vpc_flow_logs_config) + * [Vpc_flow_logs_service.delete_vpc_flow_logs_config](#vpc_flow_logs_service.delete_vpc_flow_logs_config) + * [Vpc_flow_logs_service.get_vpc_flow_logs_config](#vpc_flow_logs_service.get_vpc_flow_logs_config) + * [Vpc_flow_logs_service.list_vpc_flow_logs_configs](#vpc_flow_logs_service.list_vpc_flow_logs_configs) + * [Vpc_flow_logs_service.update_vpc_flow_logs_config](#vpc_flow_logs_service.update_vpc_flow_logs_config) * [Reachability_service.create_connectivity_test](#reachability_service.create_connectivity_test) * [Reachability_service.delete_connectivity_test](#reachability_service.delete_connectivity_test) * [Reachability_service.get_connectivity_test](#reachability_service.get_connectivity_test) @@ -148,6 +153,91 @@ __Usage:__ +### Vpc_flow_logs_service.create_vpc_flow_logs_config + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-networkmanagement/samples/generated/v1/vpc_flow_logs_service.create_vpc_flow_logs_config.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-networkmanagement/samples/generated/v1/vpc_flow_logs_service.create_vpc_flow_logs_config.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-networkmanagement/samples/generated/v1/vpc_flow_logs_service.create_vpc_flow_logs_config.js` + + +----- + + + + +### Vpc_flow_logs_service.delete_vpc_flow_logs_config + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-networkmanagement/samples/generated/v1/vpc_flow_logs_service.delete_vpc_flow_logs_config.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-networkmanagement/samples/generated/v1/vpc_flow_logs_service.delete_vpc_flow_logs_config.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-networkmanagement/samples/generated/v1/vpc_flow_logs_service.delete_vpc_flow_logs_config.js` + + +----- + + + + +### Vpc_flow_logs_service.get_vpc_flow_logs_config + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-networkmanagement/samples/generated/v1/vpc_flow_logs_service.get_vpc_flow_logs_config.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-networkmanagement/samples/generated/v1/vpc_flow_logs_service.get_vpc_flow_logs_config.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-networkmanagement/samples/generated/v1/vpc_flow_logs_service.get_vpc_flow_logs_config.js` + + +----- + + + + +### Vpc_flow_logs_service.list_vpc_flow_logs_configs + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-networkmanagement/samples/generated/v1/vpc_flow_logs_service.list_vpc_flow_logs_configs.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-networkmanagement/samples/generated/v1/vpc_flow_logs_service.list_vpc_flow_logs_configs.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-networkmanagement/samples/generated/v1/vpc_flow_logs_service.list_vpc_flow_logs_configs.js` + + +----- + + + + +### Vpc_flow_logs_service.update_vpc_flow_logs_config + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-networkmanagement/samples/generated/v1/vpc_flow_logs_service.update_vpc_flow_logs_config.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-networkmanagement/samples/generated/v1/vpc_flow_logs_service.update_vpc_flow_logs_config.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-networkmanagement/samples/generated/v1/vpc_flow_logs_service.update_vpc_flow_logs_config.js` + + +----- + + + + ### Reachability_service.create_connectivity_test View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-networkmanagement/samples/generated/v1beta1/reachability_service.create_connectivity_test.js). diff --git a/packages/google-cloud-networkmanagement/samples/generated/v1/snippet_metadata_google.cloud.networkmanagement.v1.json b/packages/google-cloud-networkmanagement/samples/generated/v1/snippet_metadata_google.cloud.networkmanagement.v1.json index 2189881fd61..729649b617b 100644 --- a/packages/google-cloud-networkmanagement/samples/generated/v1/snippet_metadata_google.cloud.networkmanagement.v1.json +++ b/packages/google-cloud-networkmanagement/samples/generated/v1/snippet_metadata_google.cloud.networkmanagement.v1.json @@ -278,6 +278,234 @@ } } } + }, + { + "regionTag": "networkmanagement_v1_generated_VpcFlowLogsService_ListVpcFlowLogsConfigs_async", + "title": "ReachabilityService listVpcFlowLogsConfigs Sample", + "origin": "API_DEFINITION", + "description": " Lists all `VpcFlowLogsConfigs` in a given project.", + "canonical": true, + "file": "vpc_flow_logs_service.list_vpc_flow_logs_configs.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 75, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListVpcFlowLogsConfigs", + "fullName": "google.cloud.networkmanagement.v1.VpcFlowLogsService.ListVpcFlowLogsConfigs", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + }, + { + "name": "filter", + "type": "TYPE_STRING" + }, + { + "name": "order_by", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.networkmanagement.v1.ListVpcFlowLogsConfigsResponse", + "client": { + "shortName": "VpcFlowLogsServiceClient", + "fullName": "google.cloud.networkmanagement.v1.VpcFlowLogsServiceClient" + }, + "method": { + "shortName": "ListVpcFlowLogsConfigs", + "fullName": "google.cloud.networkmanagement.v1.VpcFlowLogsService.ListVpcFlowLogsConfigs", + "service": { + "shortName": "VpcFlowLogsService", + "fullName": "google.cloud.networkmanagement.v1.VpcFlowLogsService" + } + } + } + }, + { + "regionTag": "networkmanagement_v1_generated_VpcFlowLogsService_GetVpcFlowLogsConfig_async", + "title": "ReachabilityService getVpcFlowLogsConfig Sample", + "origin": "API_DEFINITION", + "description": " Gets the details of a specific `VpcFlowLogsConfig`.", + "canonical": true, + "file": "vpc_flow_logs_service.get_vpc_flow_logs_config.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 54, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetVpcFlowLogsConfig", + "fullName": "google.cloud.networkmanagement.v1.VpcFlowLogsService.GetVpcFlowLogsConfig", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.networkmanagement.v1.VpcFlowLogsConfig", + "client": { + "shortName": "VpcFlowLogsServiceClient", + "fullName": "google.cloud.networkmanagement.v1.VpcFlowLogsServiceClient" + }, + "method": { + "shortName": "GetVpcFlowLogsConfig", + "fullName": "google.cloud.networkmanagement.v1.VpcFlowLogsService.GetVpcFlowLogsConfig", + "service": { + "shortName": "VpcFlowLogsService", + "fullName": "google.cloud.networkmanagement.v1.VpcFlowLogsService" + } + } + } + }, + { + "regionTag": "networkmanagement_v1_generated_VpcFlowLogsService_CreateVpcFlowLogsConfig_async", + "title": "ReachabilityService createVpcFlowLogsConfig Sample", + "origin": "API_DEFINITION", + "description": " Creates a new `VpcFlowLogsConfig`. If a configuration with the exact same settings already exists (even if the ID is different), the creation fails. Notes: 1. Creating a configuration with state=DISABLED will fail 2. The following fields are not considered as `settings` for the purpose of the check mentioned above, therefore - creating another configuration with the same fields but different values for the following fields will fail as well: * name * create_time * update_time * labels * description", + "canonical": true, + "file": "vpc_flow_logs_service.create_vpc_flow_logs_config.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 65, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateVpcFlowLogsConfig", + "fullName": "google.cloud.networkmanagement.v1.VpcFlowLogsService.CreateVpcFlowLogsConfig", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "vpc_flow_logs_config_id", + "type": "TYPE_STRING" + }, + { + "name": "vpc_flow_logs_config", + "type": ".google.cloud.networkmanagement.v1.VpcFlowLogsConfig" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "VpcFlowLogsServiceClient", + "fullName": "google.cloud.networkmanagement.v1.VpcFlowLogsServiceClient" + }, + "method": { + "shortName": "CreateVpcFlowLogsConfig", + "fullName": "google.cloud.networkmanagement.v1.VpcFlowLogsService.CreateVpcFlowLogsConfig", + "service": { + "shortName": "VpcFlowLogsService", + "fullName": "google.cloud.networkmanagement.v1.VpcFlowLogsService" + } + } + } + }, + { + "regionTag": "networkmanagement_v1_generated_VpcFlowLogsService_UpdateVpcFlowLogsConfig_async", + "title": "ReachabilityService updateVpcFlowLogsConfig Sample", + "origin": "API_DEFINITION", + "description": " Updates an existing `VpcFlowLogsConfig`. If a configuration with the exact same settings already exists (even if the ID is different), the creation fails. Notes: 1. Updating a configuration with state=DISABLED will fail. 2. The following fields are not considered as `settings` for the purpose of the check mentioned above, therefore - updating another configuration with the same fields but different values for the following fields will fail as well: * name * create_time * update_time * labels * description", + "canonical": true, + "file": "vpc_flow_logs_service.update_vpc_flow_logs_config.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 60, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateVpcFlowLogsConfig", + "fullName": "google.cloud.networkmanagement.v1.VpcFlowLogsService.UpdateVpcFlowLogsConfig", + "async": true, + "parameters": [ + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + }, + { + "name": "vpc_flow_logs_config", + "type": ".google.cloud.networkmanagement.v1.VpcFlowLogsConfig" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "VpcFlowLogsServiceClient", + "fullName": "google.cloud.networkmanagement.v1.VpcFlowLogsServiceClient" + }, + "method": { + "shortName": "UpdateVpcFlowLogsConfig", + "fullName": "google.cloud.networkmanagement.v1.VpcFlowLogsService.UpdateVpcFlowLogsConfig", + "service": { + "shortName": "VpcFlowLogsService", + "fullName": "google.cloud.networkmanagement.v1.VpcFlowLogsService" + } + } + } + }, + { + "regionTag": "networkmanagement_v1_generated_VpcFlowLogsService_DeleteVpcFlowLogsConfig_async", + "title": "ReachabilityService deleteVpcFlowLogsConfig Sample", + "origin": "API_DEFINITION", + "description": " Deletes a specific `VpcFlowLogsConfig`.", + "canonical": true, + "file": "vpc_flow_logs_service.delete_vpc_flow_logs_config.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 55, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteVpcFlowLogsConfig", + "fullName": "google.cloud.networkmanagement.v1.VpcFlowLogsService.DeleteVpcFlowLogsConfig", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "VpcFlowLogsServiceClient", + "fullName": "google.cloud.networkmanagement.v1.VpcFlowLogsServiceClient" + }, + "method": { + "shortName": "DeleteVpcFlowLogsConfig", + "fullName": "google.cloud.networkmanagement.v1.VpcFlowLogsService.DeleteVpcFlowLogsConfig", + "service": { + "shortName": "VpcFlowLogsService", + "fullName": "google.cloud.networkmanagement.v1.VpcFlowLogsService" + } + } + } } ] } \ No newline at end of file diff --git a/packages/google-cloud-networkmanagement/samples/generated/v1/vpc_flow_logs_service.create_vpc_flow_logs_config.js b/packages/google-cloud-networkmanagement/samples/generated/v1/vpc_flow_logs_service.create_vpc_flow_logs_config.js new file mode 100644 index 00000000000..3a712fef451 --- /dev/null +++ b/packages/google-cloud-networkmanagement/samples/generated/v1/vpc_flow_logs_service.create_vpc_flow_logs_config.js @@ -0,0 +1,73 @@ +// Copyright 2025 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. ** + + + +'use strict'; + +function main(parent, vpcFlowLogsConfigId, vpcFlowLogsConfig) { + // [START networkmanagement_v1_generated_VpcFlowLogsService_CreateVpcFlowLogsConfig_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The parent resource of the VPC Flow Logs configuration to create: + * `projects/{project_id}/locations/global` + */ + // const parent = 'abc123' + /** + * Required. ID of the `VpcFlowLogsConfig`. + */ + // const vpcFlowLogsConfigId = 'abc123' + /** + * Required. A `VpcFlowLogsConfig` resource + */ + // const vpcFlowLogsConfig = {} + + // Imports the Networkmanagement library + const {VpcFlowLogsServiceClient} = require('@google-cloud/network-management').v1; + + // Instantiates a client + const networkmanagementClient = new VpcFlowLogsServiceClient(); + + async function callCreateVpcFlowLogsConfig() { + // Construct request + const request = { + parent, + vpcFlowLogsConfigId, + vpcFlowLogsConfig, + }; + + // Run request + const [operation] = await networkmanagementClient.createVpcFlowLogsConfig(request); + const [response] = await operation.promise(); + console.log(response); + } + + callCreateVpcFlowLogsConfig(); + // [END networkmanagement_v1_generated_VpcFlowLogsService_CreateVpcFlowLogsConfig_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-networkmanagement/samples/generated/v1/vpc_flow_logs_service.delete_vpc_flow_logs_config.js b/packages/google-cloud-networkmanagement/samples/generated/v1/vpc_flow_logs_service.delete_vpc_flow_logs_config.js new file mode 100644 index 00000000000..ae8c0fa9df8 --- /dev/null +++ b/packages/google-cloud-networkmanagement/samples/generated/v1/vpc_flow_logs_service.delete_vpc_flow_logs_config.js @@ -0,0 +1,63 @@ +// Copyright 2025 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. ** + + + +'use strict'; + +function main(name) { + // [START networkmanagement_v1_generated_VpcFlowLogsService_DeleteVpcFlowLogsConfig_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. `VpcFlowLogsConfig` resource name using the form: + * `projects/{project_id}/locations/global/vpcFlowLogsConfigs/{vpc_flow_logs_config}` + */ + // const name = 'abc123' + + // Imports the Networkmanagement library + const {VpcFlowLogsServiceClient} = require('@google-cloud/network-management').v1; + + // Instantiates a client + const networkmanagementClient = new VpcFlowLogsServiceClient(); + + async function callDeleteVpcFlowLogsConfig() { + // Construct request + const request = { + name, + }; + + // Run request + const [operation] = await networkmanagementClient.deleteVpcFlowLogsConfig(request); + const [response] = await operation.promise(); + console.log(response); + } + + callDeleteVpcFlowLogsConfig(); + // [END networkmanagement_v1_generated_VpcFlowLogsService_DeleteVpcFlowLogsConfig_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-networkmanagement/samples/generated/v1/vpc_flow_logs_service.get_vpc_flow_logs_config.js b/packages/google-cloud-networkmanagement/samples/generated/v1/vpc_flow_logs_service.get_vpc_flow_logs_config.js new file mode 100644 index 00000000000..a61a6c3a687 --- /dev/null +++ b/packages/google-cloud-networkmanagement/samples/generated/v1/vpc_flow_logs_service.get_vpc_flow_logs_config.js @@ -0,0 +1,62 @@ +// Copyright 2025 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. ** + + + +'use strict'; + +function main(name) { + // [START networkmanagement_v1_generated_VpcFlowLogsService_GetVpcFlowLogsConfig_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. `VpcFlowLogsConfig` resource name using the form: + * `projects/{project_id}/locations/global/vpcFlowLogsConfigs/{vpc_flow_logs_config}` + */ + // const name = 'abc123' + + // Imports the Networkmanagement library + const {VpcFlowLogsServiceClient} = require('@google-cloud/network-management').v1; + + // Instantiates a client + const networkmanagementClient = new VpcFlowLogsServiceClient(); + + async function callGetVpcFlowLogsConfig() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await networkmanagementClient.getVpcFlowLogsConfig(request); + console.log(response); + } + + callGetVpcFlowLogsConfig(); + // [END networkmanagement_v1_generated_VpcFlowLogsService_GetVpcFlowLogsConfig_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-networkmanagement/samples/generated/v1/vpc_flow_logs_service.list_vpc_flow_logs_configs.js b/packages/google-cloud-networkmanagement/samples/generated/v1/vpc_flow_logs_service.list_vpc_flow_logs_configs.js new file mode 100644 index 00000000000..6710942c9ab --- /dev/null +++ b/packages/google-cloud-networkmanagement/samples/generated/v1/vpc_flow_logs_service.list_vpc_flow_logs_configs.js @@ -0,0 +1,83 @@ +// Copyright 2025 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. ** + + + +'use strict'; + +function main(parent) { + // [START networkmanagement_v1_generated_VpcFlowLogsService_ListVpcFlowLogsConfigs_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The parent resource of the VpcFlowLogsConfig: + * `projects/{project_id}/locations/global` + */ + // const parent = 'abc123' + /** + * Optional. Number of `VpcFlowLogsConfigs` to return. + */ + // const pageSize = 1234 + /** + * Optional. Page token from an earlier query, as returned in + * `next_page_token`. + */ + // const pageToken = 'abc123' + /** + * Optional. Lists the `VpcFlowLogsConfigs` that match the filter expression. + * A filter expression must use the supported CEL logic operators + * (https://cloud.google.com/vpc/docs/about-flow-logs-records#supported_cel_logic_operators). + */ + // const filter = 'abc123' + /** + * Optional. Field to use to sort the list. + */ + // const orderBy = 'abc123' + + // Imports the Networkmanagement library + const {VpcFlowLogsServiceClient} = require('@google-cloud/network-management').v1; + + // Instantiates a client + const networkmanagementClient = new VpcFlowLogsServiceClient(); + + async function callListVpcFlowLogsConfigs() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = networkmanagementClient.listVpcFlowLogsConfigsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListVpcFlowLogsConfigs(); + // [END networkmanagement_v1_generated_VpcFlowLogsService_ListVpcFlowLogsConfigs_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-networkmanagement/samples/generated/v1/vpc_flow_logs_service.update_vpc_flow_logs_config.js b/packages/google-cloud-networkmanagement/samples/generated/v1/vpc_flow_logs_service.update_vpc_flow_logs_config.js new file mode 100644 index 00000000000..beac2daead6 --- /dev/null +++ b/packages/google-cloud-networkmanagement/samples/generated/v1/vpc_flow_logs_service.update_vpc_flow_logs_config.js @@ -0,0 +1,68 @@ +// Copyright 2025 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. ** + + + +'use strict'; + +function main(updateMask, vpcFlowLogsConfig) { + // [START networkmanagement_v1_generated_VpcFlowLogsService_UpdateVpcFlowLogsConfig_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Mask of fields to update. At least one path must be supplied in + * this field. + */ + // const updateMask = {} + /** + * Required. Only fields specified in update_mask are updated. + */ + // const vpcFlowLogsConfig = {} + + // Imports the Networkmanagement library + const {VpcFlowLogsServiceClient} = require('@google-cloud/network-management').v1; + + // Instantiates a client + const networkmanagementClient = new VpcFlowLogsServiceClient(); + + async function callUpdateVpcFlowLogsConfig() { + // Construct request + const request = { + updateMask, + vpcFlowLogsConfig, + }; + + // Run request + const [operation] = await networkmanagementClient.updateVpcFlowLogsConfig(request); + const [response] = await operation.promise(); + console.log(response); + } + + callUpdateVpcFlowLogsConfig(); + // [END networkmanagement_v1_generated_VpcFlowLogsService_UpdateVpcFlowLogsConfig_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-networkmanagement/src/index.ts b/packages/google-cloud-networkmanagement/src/index.ts index ef388608fa3..dfdcdec02d3 100644 --- a/packages/google-cloud-networkmanagement/src/index.ts +++ b/packages/google-cloud-networkmanagement/src/index.ts @@ -21,8 +21,15 @@ import * as v1beta1 from './v1beta1'; const ReachabilityServiceClient = v1.ReachabilityServiceClient; type ReachabilityServiceClient = v1.ReachabilityServiceClient; +const VpcFlowLogsServiceClient = v1.VpcFlowLogsServiceClient; +type VpcFlowLogsServiceClient = v1.VpcFlowLogsServiceClient; -export {v1, v1beta1, ReachabilityServiceClient}; -export default {v1, v1beta1, ReachabilityServiceClient}; +export {v1, v1beta1, ReachabilityServiceClient, VpcFlowLogsServiceClient}; +export default { + v1, + v1beta1, + ReachabilityServiceClient, + VpcFlowLogsServiceClient, +}; import * as protos from '../protos/protos'; export {protos}; diff --git a/packages/google-cloud-networkmanagement/src/v1/gapic_metadata.json b/packages/google-cloud-networkmanagement/src/v1/gapic_metadata.json index 0a5d92ed4df..bbef9914e06 100644 --- a/packages/google-cloud-networkmanagement/src/v1/gapic_metadata.json +++ b/packages/google-cloud-networkmanagement/src/v1/gapic_metadata.json @@ -82,6 +82,74 @@ } } } + }, + "VpcFlowLogsService": { + "clients": { + "grpc": { + "libraryClient": "VpcFlowLogsServiceClient", + "rpcs": { + "GetVpcFlowLogsConfig": { + "methods": [ + "getVpcFlowLogsConfig" + ] + }, + "CreateVpcFlowLogsConfig": { + "methods": [ + "createVpcFlowLogsConfig" + ] + }, + "UpdateVpcFlowLogsConfig": { + "methods": [ + "updateVpcFlowLogsConfig" + ] + }, + "DeleteVpcFlowLogsConfig": { + "methods": [ + "deleteVpcFlowLogsConfig" + ] + }, + "ListVpcFlowLogsConfigs": { + "methods": [ + "listVpcFlowLogsConfigs", + "listVpcFlowLogsConfigsStream", + "listVpcFlowLogsConfigsAsync" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "VpcFlowLogsServiceClient", + "rpcs": { + "GetVpcFlowLogsConfig": { + "methods": [ + "getVpcFlowLogsConfig" + ] + }, + "CreateVpcFlowLogsConfig": { + "methods": [ + "createVpcFlowLogsConfig" + ] + }, + "UpdateVpcFlowLogsConfig": { + "methods": [ + "updateVpcFlowLogsConfig" + ] + }, + "DeleteVpcFlowLogsConfig": { + "methods": [ + "deleteVpcFlowLogsConfig" + ] + }, + "ListVpcFlowLogsConfigs": { + "methods": [ + "listVpcFlowLogsConfigs", + "listVpcFlowLogsConfigsStream", + "listVpcFlowLogsConfigsAsync" + ] + } + } + } + } } } } diff --git a/packages/google-cloud-networkmanagement/src/v1/index.ts b/packages/google-cloud-networkmanagement/src/v1/index.ts index 7c92a5ea0d0..c84086be8c7 100644 --- a/packages/google-cloud-networkmanagement/src/v1/index.ts +++ b/packages/google-cloud-networkmanagement/src/v1/index.ts @@ -17,3 +17,4 @@ // ** All changes to this file may be overwritten. ** export {ReachabilityServiceClient} from './reachability_service_client'; +export {VpcFlowLogsServiceClient} from './vpc_flow_logs_service_client'; diff --git a/packages/google-cloud-networkmanagement/src/v1/reachability_service_client.ts b/packages/google-cloud-networkmanagement/src/v1/reachability_service_client.ts index 58cb8c85604..87ccca4429b 100644 --- a/packages/google-cloud-networkmanagement/src/v1/reachability_service_client.ts +++ b/packages/google-cloud-networkmanagement/src/v1/reachability_service_client.ts @@ -227,6 +227,9 @@ export class ReachabilityServiceClient { projectPathTemplate: new this._gaxModule.PathTemplate( 'projects/{project}' ), + vpcFlowLogsConfigPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/vpcFlowLogsConfigs/{vpc_flow_logs_config}' + ), }; // Some of the methods on this service return "paged" results, @@ -1948,6 +1951,67 @@ export class ReachabilityServiceClient { return this.pathTemplates.projectPathTemplate.match(projectName).project; } + /** + * Return a fully-qualified vpcFlowLogsConfig resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} vpc_flow_logs_config + * @returns {string} Resource name string. + */ + vpcFlowLogsConfigPath( + project: string, + location: string, + vpcFlowLogsConfig: string + ) { + return this.pathTemplates.vpcFlowLogsConfigPathTemplate.render({ + project: project, + location: location, + vpc_flow_logs_config: vpcFlowLogsConfig, + }); + } + + /** + * Parse the project from VpcFlowLogsConfig resource. + * + * @param {string} vpcFlowLogsConfigName + * A fully-qualified path representing VpcFlowLogsConfig resource. + * @returns {string} A string representing the project. + */ + matchProjectFromVpcFlowLogsConfigName(vpcFlowLogsConfigName: string) { + return this.pathTemplates.vpcFlowLogsConfigPathTemplate.match( + vpcFlowLogsConfigName + ).project; + } + + /** + * Parse the location from VpcFlowLogsConfig resource. + * + * @param {string} vpcFlowLogsConfigName + * A fully-qualified path representing VpcFlowLogsConfig resource. + * @returns {string} A string representing the location. + */ + matchLocationFromVpcFlowLogsConfigName(vpcFlowLogsConfigName: string) { + return this.pathTemplates.vpcFlowLogsConfigPathTemplate.match( + vpcFlowLogsConfigName + ).location; + } + + /** + * Parse the vpc_flow_logs_config from VpcFlowLogsConfig resource. + * + * @param {string} vpcFlowLogsConfigName + * A fully-qualified path representing VpcFlowLogsConfig resource. + * @returns {string} A string representing the vpc_flow_logs_config. + */ + matchVpcFlowLogsConfigFromVpcFlowLogsConfigName( + vpcFlowLogsConfigName: string + ) { + return this.pathTemplates.vpcFlowLogsConfigPathTemplate.match( + vpcFlowLogsConfigName + ).vpc_flow_logs_config; + } + /** * Terminate the gRPC channel and close the client. * diff --git a/packages/google-cloud-networkmanagement/src/v1/reachability_service_proto_list.json b/packages/google-cloud-networkmanagement/src/v1/reachability_service_proto_list.json index d84c76feae1..e2a20fc586f 100644 --- a/packages/google-cloud-networkmanagement/src/v1/reachability_service_proto_list.json +++ b/packages/google-cloud-networkmanagement/src/v1/reachability_service_proto_list.json @@ -1,5 +1,7 @@ [ "../../protos/google/cloud/networkmanagement/v1/connectivity_test.proto", "../../protos/google/cloud/networkmanagement/v1/reachability.proto", - "../../protos/google/cloud/networkmanagement/v1/trace.proto" + "../../protos/google/cloud/networkmanagement/v1/trace.proto", + "../../protos/google/cloud/networkmanagement/v1/vpc_flow_logs.proto", + "../../protos/google/cloud/networkmanagement/v1/vpc_flow_logs_config.proto" ] diff --git a/packages/google-cloud-networkmanagement/src/v1/vpc_flow_logs_service_client.ts b/packages/google-cloud-networkmanagement/src/v1/vpc_flow_logs_service_client.ts new file mode 100644 index 00000000000..6eaacf93c4e --- /dev/null +++ b/packages/google-cloud-networkmanagement/src/v1/vpc_flow_logs_service_client.ts @@ -0,0 +1,1863 @@ +// Copyright 2025 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +/* global window */ +import type * as gax from 'google-gax'; +import type { + Callback, + CallOptions, + Descriptors, + ClientOptions, + GrpcClientOptions, + LROperation, + PaginationCallback, + GaxCall, + IamClient, + IamProtos, + LocationsClient, + LocationProtos, +} from 'google-gax'; +import {Transform} from 'stream'; +import * as protos from '../../protos/protos'; +import jsonProtos = require('../../protos/protos.json'); + +/** + * Client JSON configuration object, loaded from + * `src/v1/vpc_flow_logs_service_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './vpc_flow_logs_service_client_config.json'; +const version = require('../../../package.json').version; + +/** + * The VPC Flow Logs service in the Google Cloud Network Management API provides + * configurations that generate Flow Logs. The service and the configuration + * resources created using this service are global. + * @class + * @memberof v1 + */ +export class VpcFlowLogsServiceClient { + 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}; + private _universeDomain: string; + private _servicePath: string; + auth: gax.GoogleAuth; + descriptors: Descriptors = { + page: {}, + stream: {}, + longrunning: {}, + batching: {}, + }; + warn: (code: string, message: string, warnType?: string) => void; + innerApiCalls: {[name: string]: Function}; + iamClient: IamClient; + locationsClient: LocationsClient; + pathTemplates: {[name: string]: gax.PathTemplate}; + operationsClient: gax.OperationsClient; + vpcFlowLogsServiceStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of VpcFlowLogsServiceClient. + * + * @param {object} [options] - The configuration object. + * The options accepted by the constructor are described in detail + * in [this document](https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#creating-the-client-instance). + * The common options are: + * @param {object} [options.credentials] - Credentials object. + * @param {string} [options.credentials.client_email] + * @param {string} [options.credentials.private_key] + * @param {string} [options.email] - Account email address. Required when + * using a .pem or .p12 keyFilename. + * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or + * .p12 key downloaded from the Google Developers Console. If you provide + * a path to a JSON file, the projectId option below is not necessary. + * NOTE: .pem and .p12 require you to specify options.email as well. + * @param {number} [options.port] - The port on which to connect to + * the remote host. + * @param {string} [options.projectId] - The project ID from the Google + * Developer's Console, e.g. 'grape-spaceship-123'. We will also check + * the environment variable GCLOUD_PROJECT for your project ID. If your + * app is running in an environment which supports + * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials}, + * your project ID will be detected automatically. + * @param {string} [options.apiEndpoint] - The domain name of the + * API remote host. + * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. + * Follows the structure of {@link gapicConfig}. + * @param {boolean} [options.fallback] - Use HTTP/1.1 REST mode. + * For more information, please check the + * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. + * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you + * need to avoid loading the default gRPC version and want to use the fallback + * HTTP implementation. Load only fallback version and pass it to the constructor: + * ``` + * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC + * const client = new VpcFlowLogsServiceClient({fallback: true}, gax); + * ``` + */ + constructor( + opts?: ClientOptions, + gaxInstance?: typeof gax | typeof gax.fallback + ) { + // Ensure that options include all the required fields. + const staticMembers = this.constructor as typeof VpcFlowLogsServiceClient; + if ( + opts?.universe_domain && + opts?.universeDomain && + opts?.universe_domain !== opts?.universeDomain + ) { + throw new Error( + 'Please set either universe_domain or universeDomain, but not both.' + ); + } + const universeDomainEnvVar = + typeof process === 'object' && typeof process.env === 'object' + ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] + : undefined; + this._universeDomain = + opts?.universeDomain ?? + opts?.universe_domain ?? + universeDomainEnvVar ?? + 'googleapis.com'; + this._servicePath = 'networkmanagement.' + this._universeDomain; + const servicePath = + opts?.servicePath || opts?.apiEndpoint || this._servicePath; + this._providedCustomServicePath = !!( + opts?.servicePath || opts?.apiEndpoint + ); + const port = opts?.port || staticMembers.port; + const clientConfig = opts?.clientConfig ?? {}; + const fallback = + opts?.fallback ?? + (typeof window !== 'undefined' && typeof window?.fetch === 'function'); + opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); + + // Request numeric enum values if REST transport is used. + opts.numericEnums = true; + + // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. + if (servicePath !== this._servicePath && !('scopes' in opts)) { + opts['scopes'] = staticMembers.scopes; + } + + // Load google-gax module synchronously if needed + if (!gaxInstance) { + gaxInstance = require('google-gax') as typeof gax; + } + + // Choose either gRPC or proto-over-HTTP implementation of google-gax. + this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; + + // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. + this._gaxGrpc = new this._gaxModule.GrpcClient(opts); + + // Save options to use in initialize() method. + this._opts = opts; + + // Save the auth object to the client, for use by other methods. + this.auth = this._gaxGrpc.auth as gax.GoogleAuth; + + // Set useJWTAccessWithScope on the auth object. + this.auth.useJWTAccessWithScope = true; + + // Set defaultServicePath on the auth object. + this.auth.defaultServicePath = this._servicePath; + + // Set the default scopes in auth client if needed. + if (servicePath === this._servicePath) { + this.auth.defaultScopes = staticMembers.scopes; + } + this.iamClient = new this._gaxModule.IamClient(this._gaxGrpc, opts); + + this.locationsClient = new this._gaxModule.LocationsClient( + this._gaxGrpc, + opts + ); + + // Determine the client header string. + const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; + if (typeof process === 'object' && '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 { + 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 = { + connectivityTestPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/global/connectivityTests/{test}' + ), + locationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}' + ), + projectPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}' + ), + vpcFlowLogsConfigPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/vpcFlowLogsConfigs/{vpc_flow_logs_config}' + ), + }; + + // 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 = { + listVpcFlowLogsConfigs: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'vpcFlowLogsConfigs' + ), + }; + + const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(jsonProtos); + // This API contains "long-running operations", which return a + // an Operation object that allows for tracking of the operation, + // rather than holding a request open. + const lroOptions: GrpcClientOptions = { + auth: this.auth, + grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined, + }; + if (opts.fallback) { + lroOptions.protoJson = protoFilesRoot; + lroOptions.httpRules = [ + { + selector: 'google.cloud.location.Locations.GetLocation', + get: '/v1/{name=projects/*/locations/*}', + }, + { + selector: 'google.cloud.location.Locations.ListLocations', + get: '/v1/{name=projects/*}/locations', + }, + { + selector: 'google.iam.v1.IAMPolicy.GetIamPolicy', + get: '/v1/{resource=projects/*/locations/global/connectivityTests/*}:getIamPolicy', + }, + { + selector: 'google.iam.v1.IAMPolicy.SetIamPolicy', + post: '/v1/{resource=projects/*/locations/global/connectivityTests/*}:setIamPolicy', + body: '*', + }, + { + selector: 'google.iam.v1.IAMPolicy.TestIamPermissions', + post: '/v1/{resource=projects/*/locations/global/connectivityTests/*}:testIamPermissions', + body: '*', + }, + { + selector: 'google.longrunning.Operations.CancelOperation', + post: '/v1/{name=projects/*/locations/global/operations/*}:cancel', + body: '*', + }, + { + selector: 'google.longrunning.Operations.DeleteOperation', + delete: '/v1/{name=projects/*/locations/global/operations/*}', + }, + { + selector: 'google.longrunning.Operations.GetOperation', + get: '/v1/{name=projects/*/locations/global/operations/*}', + }, + { + selector: 'google.longrunning.Operations.ListOperations', + get: '/v1/{name=projects/*/locations/global}/operations', + }, + ]; + } + this.operationsClient = this._gaxModule + .lro(lroOptions) + .operationsClient(opts); + const createVpcFlowLogsConfigResponse = protoFilesRoot.lookup( + '.google.cloud.networkmanagement.v1.VpcFlowLogsConfig' + ) as gax.protobuf.Type; + const createVpcFlowLogsConfigMetadata = protoFilesRoot.lookup( + '.google.cloud.networkmanagement.v1.OperationMetadata' + ) as gax.protobuf.Type; + const updateVpcFlowLogsConfigResponse = protoFilesRoot.lookup( + '.google.cloud.networkmanagement.v1.VpcFlowLogsConfig' + ) as gax.protobuf.Type; + const updateVpcFlowLogsConfigMetadata = protoFilesRoot.lookup( + '.google.cloud.networkmanagement.v1.OperationMetadata' + ) as gax.protobuf.Type; + const deleteVpcFlowLogsConfigResponse = protoFilesRoot.lookup( + '.google.protobuf.Empty' + ) as gax.protobuf.Type; + const deleteVpcFlowLogsConfigMetadata = protoFilesRoot.lookup( + '.google.cloud.networkmanagement.v1.OperationMetadata' + ) as gax.protobuf.Type; + + this.descriptors.longrunning = { + createVpcFlowLogsConfig: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + createVpcFlowLogsConfigResponse.decode.bind( + createVpcFlowLogsConfigResponse + ), + createVpcFlowLogsConfigMetadata.decode.bind( + createVpcFlowLogsConfigMetadata + ) + ), + updateVpcFlowLogsConfig: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + updateVpcFlowLogsConfigResponse.decode.bind( + updateVpcFlowLogsConfigResponse + ), + updateVpcFlowLogsConfigMetadata.decode.bind( + updateVpcFlowLogsConfigMetadata + ) + ), + deleteVpcFlowLogsConfig: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + deleteVpcFlowLogsConfigResponse.decode.bind( + deleteVpcFlowLogsConfigResponse + ), + deleteVpcFlowLogsConfigMetadata.decode.bind( + deleteVpcFlowLogsConfigMetadata + ) + ), + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.networkmanagement.v1.VpcFlowLogsService', + gapicConfig as gax.ClientConfig, + opts.clientConfig || {}, + {'x-goog-api-client': clientHeader.join(' ')} + ); + + // Set up a dictionary of "inner API calls"; the core implementation + // of calling the API is handled in `google-gax`, with this code + // merely providing the destination and request information. + this.innerApiCalls = {}; + + // Add a warn function to the client constructor so it can be easily tested. + this.warn = this._gaxModule.warn; + } + + /** + * Initialize the client. + * Performs asynchronous operations (such as authentication) and prepares the client. + * This function will be called automatically when any class method is called for the + * first time, but if you need to initialize it before calling an actual method, + * feel free to call initialize() directly. + * + * You can await on this method if you want to make sure the client is initialized. + * + * @returns {Promise} A promise that resolves to an authenticated service stub. + */ + initialize() { + // If the client stub promise is already initialized, return immediately. + if (this.vpcFlowLogsServiceStub) { + return this.vpcFlowLogsServiceStub; + } + + // Put together the "service stub" for + // google.cloud.networkmanagement.v1.VpcFlowLogsService. + this.vpcFlowLogsServiceStub = this._gaxGrpc.createStub( + this._opts.fallback + ? (this._protos as protobuf.Root).lookupService( + 'google.cloud.networkmanagement.v1.VpcFlowLogsService' + ) + : // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.networkmanagement.v1 + .VpcFlowLogsService, + 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 vpcFlowLogsServiceStubMethods = [ + 'listVpcFlowLogsConfigs', + 'getVpcFlowLogsConfig', + 'createVpcFlowLogsConfig', + 'updateVpcFlowLogsConfig', + 'deleteVpcFlowLogsConfig', + ]; + for (const methodName of vpcFlowLogsServiceStubMethods) { + const callPromise = this.vpcFlowLogsServiceStub.then( + stub => + (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, + (err: Error | null | undefined) => () => { + throw err; + } + ); + + const descriptor = + this.descriptors.page[methodName] || + this.descriptors.longrunning[methodName] || + undefined; + const apiCall = this._gaxModule.createApiCall( + callPromise, + this._defaults[methodName], + descriptor, + this._opts.fallback + ); + + this.innerApiCalls[methodName] = apiCall; + } + + return this.vpcFlowLogsServiceStub; + } + + /** + * The DNS address for this API service. + * @deprecated Use the apiEndpoint method of the client instance. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static servicePath is deprecated, please use the instance method instead.', + 'DeprecationWarning' + ); + } + return 'networkmanagement.googleapis.com'; + } + + /** + * The DNS address for this API service - same as servicePath. + * @deprecated Use the apiEndpoint method of the client instance. + * @returns {string} The DNS address for this service. + */ + static get apiEndpoint() { + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static apiEndpoint is deprecated, please use the instance method instead.', + 'DeprecationWarning' + ); + } + return 'networkmanagement.googleapis.com'; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + get apiEndpoint() { + return this._servicePath; + } + + get universeDomain() { + return this._universeDomain; + } + + /** + * The port for this API service. + * @returns {number} The default port for this service. + */ + static get port() { + return 443; + } + + /** + * The scopes needed to make gRPC calls for every method defined + * in this service. + * @returns {string[]} List of default scopes. + */ + static get scopes() { + return ['https://www.googleapis.com/auth/cloud-platform']; + } + + getProjectId(): Promise; + getProjectId(callback: Callback): void; + /** + * Return the project ID used by this class. + * @returns {Promise} A promise that resolves to string containing the project ID. + */ + getProjectId( + callback?: Callback + ): Promise | void { + if (callback) { + this.auth.getProjectId(callback); + return; + } + return this.auth.getProjectId(); + } + + // ------------------- + // -- Service calls -- + // ------------------- + /** + * Gets the details of a specific `VpcFlowLogsConfig`. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. `VpcFlowLogsConfig` resource name using the form: + * `projects/{project_id}/locations/global/vpcFlowLogsConfigs/{vpc_flow_logs_config}` + * @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 {@link protos.google.cloud.networkmanagement.v1.VpcFlowLogsConfig|VpcFlowLogsConfig}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vpc_flow_logs_service.get_vpc_flow_logs_config.js + * region_tag:networkmanagement_v1_generated_VpcFlowLogsService_GetVpcFlowLogsConfig_async + */ + getVpcFlowLogsConfig( + request?: protos.google.cloud.networkmanagement.v1.IGetVpcFlowLogsConfigRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.networkmanagement.v1.IVpcFlowLogsConfig, + ( + | protos.google.cloud.networkmanagement.v1.IGetVpcFlowLogsConfigRequest + | undefined + ), + {} | undefined, + ] + >; + getVpcFlowLogsConfig( + request: protos.google.cloud.networkmanagement.v1.IGetVpcFlowLogsConfigRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.networkmanagement.v1.IVpcFlowLogsConfig, + | protos.google.cloud.networkmanagement.v1.IGetVpcFlowLogsConfigRequest + | null + | undefined, + {} | null | undefined + > + ): void; + getVpcFlowLogsConfig( + request: protos.google.cloud.networkmanagement.v1.IGetVpcFlowLogsConfigRequest, + callback: Callback< + protos.google.cloud.networkmanagement.v1.IVpcFlowLogsConfig, + | protos.google.cloud.networkmanagement.v1.IGetVpcFlowLogsConfigRequest + | null + | undefined, + {} | null | undefined + > + ): void; + getVpcFlowLogsConfig( + request?: protos.google.cloud.networkmanagement.v1.IGetVpcFlowLogsConfigRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.networkmanagement.v1.IVpcFlowLogsConfig, + | protos.google.cloud.networkmanagement.v1.IGetVpcFlowLogsConfigRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.networkmanagement.v1.IVpcFlowLogsConfig, + | protos.google.cloud.networkmanagement.v1.IGetVpcFlowLogsConfigRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.networkmanagement.v1.IVpcFlowLogsConfig, + ( + | protos.google.cloud.networkmanagement.v1.IGetVpcFlowLogsConfigRequest + | undefined + ), + {} | undefined, + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.getVpcFlowLogsConfig(request, options, callback); + } + + /** + * Creates a new `VpcFlowLogsConfig`. + * If a configuration with the exact same settings already exists (even if the + * ID is different), the creation fails. + * Notes: + * + * 1. Creating a configuration with state=DISABLED will fail + * 2. The following fields are not considered as `settings` for the purpose + * of the check mentioned above, therefore - creating another configuration + * with the same fields but different values for the following fields will + * fail as well: + * * name + * * create_time + * * update_time + * * labels + * * description + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource of the VPC Flow Logs configuration to create: + * `projects/{project_id}/locations/global` + * @param {string} request.vpcFlowLogsConfigId + * Required. ID of the `VpcFlowLogsConfig`. + * @param {google.cloud.networkmanagement.v1.VpcFlowLogsConfig} request.vpcFlowLogsConfig + * Required. A `VpcFlowLogsConfig` 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 + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vpc_flow_logs_service.create_vpc_flow_logs_config.js + * region_tag:networkmanagement_v1_generated_VpcFlowLogsService_CreateVpcFlowLogsConfig_async + */ + createVpcFlowLogsConfig( + request?: protos.google.cloud.networkmanagement.v1.ICreateVpcFlowLogsConfigRequest, + options?: CallOptions + ): Promise< + [ + LROperation< + protos.google.cloud.networkmanagement.v1.IVpcFlowLogsConfig, + protos.google.cloud.networkmanagement.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; + createVpcFlowLogsConfig( + request: protos.google.cloud.networkmanagement.v1.ICreateVpcFlowLogsConfigRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.networkmanagement.v1.IVpcFlowLogsConfig, + protos.google.cloud.networkmanagement.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + createVpcFlowLogsConfig( + request: protos.google.cloud.networkmanagement.v1.ICreateVpcFlowLogsConfigRequest, + callback: Callback< + LROperation< + protos.google.cloud.networkmanagement.v1.IVpcFlowLogsConfig, + protos.google.cloud.networkmanagement.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + createVpcFlowLogsConfig( + request?: protos.google.cloud.networkmanagement.v1.ICreateVpcFlowLogsConfigRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.networkmanagement.v1.IVpcFlowLogsConfig, + protos.google.cloud.networkmanagement.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.networkmanagement.v1.IVpcFlowLogsConfig, + protos.google.cloud.networkmanagement.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): Promise< + [ + LROperation< + protos.google.cloud.networkmanagement.v1.IVpcFlowLogsConfig, + protos.google.cloud.networkmanagement.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.createVpcFlowLogsConfig( + request, + options, + callback + ); + } + /** + * Check the status of the long running operation returned by `createVpcFlowLogsConfig()`. + * @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 {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vpc_flow_logs_service.create_vpc_flow_logs_config.js + * region_tag:networkmanagement_v1_generated_VpcFlowLogsService_CreateVpcFlowLogsConfig_async + */ + async checkCreateVpcFlowLogsConfigProgress( + name: string + ): Promise< + LROperation< + protos.google.cloud.networkmanagement.v1.VpcFlowLogsConfig, + protos.google.cloud.networkmanagement.v1.OperationMetadata + > + > { + const request = + new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( + {name} + ); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.createVpcFlowLogsConfig, + this._gaxModule.createDefaultBackoffSettings() + ); + return decodeOperation as LROperation< + protos.google.cloud.networkmanagement.v1.VpcFlowLogsConfig, + protos.google.cloud.networkmanagement.v1.OperationMetadata + >; + } + /** + * Updates an existing `VpcFlowLogsConfig`. + * If a configuration with the exact same settings already exists (even if the + * ID is different), the creation fails. + * Notes: + * + * 1. Updating a configuration with state=DISABLED will fail. + * 2. The following fields are not considered as `settings` for the purpose + * of the check mentioned above, therefore - updating another configuration + * with the same fields but different values for the following fields will + * fail as well: + * * name + * * create_time + * * update_time + * * labels + * * description + * + * @param {Object} request + * The request object that will be sent. + * @param {google.protobuf.FieldMask} request.updateMask + * Required. Mask of fields to update. At least one path must be supplied in + * this field. + * @param {google.cloud.networkmanagement.v1.VpcFlowLogsConfig} request.vpcFlowLogsConfig + * Required. Only fields specified in update_mask are updated. + * @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 {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vpc_flow_logs_service.update_vpc_flow_logs_config.js + * region_tag:networkmanagement_v1_generated_VpcFlowLogsService_UpdateVpcFlowLogsConfig_async + */ + updateVpcFlowLogsConfig( + request?: protos.google.cloud.networkmanagement.v1.IUpdateVpcFlowLogsConfigRequest, + options?: CallOptions + ): Promise< + [ + LROperation< + protos.google.cloud.networkmanagement.v1.IVpcFlowLogsConfig, + protos.google.cloud.networkmanagement.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; + updateVpcFlowLogsConfig( + request: protos.google.cloud.networkmanagement.v1.IUpdateVpcFlowLogsConfigRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.networkmanagement.v1.IVpcFlowLogsConfig, + protos.google.cloud.networkmanagement.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + updateVpcFlowLogsConfig( + request: protos.google.cloud.networkmanagement.v1.IUpdateVpcFlowLogsConfigRequest, + callback: Callback< + LROperation< + protos.google.cloud.networkmanagement.v1.IVpcFlowLogsConfig, + protos.google.cloud.networkmanagement.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + updateVpcFlowLogsConfig( + request?: protos.google.cloud.networkmanagement.v1.IUpdateVpcFlowLogsConfigRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.networkmanagement.v1.IVpcFlowLogsConfig, + protos.google.cloud.networkmanagement.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.networkmanagement.v1.IVpcFlowLogsConfig, + protos.google.cloud.networkmanagement.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): Promise< + [ + LROperation< + protos.google.cloud.networkmanagement.v1.IVpcFlowLogsConfig, + protos.google.cloud.networkmanagement.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + 'vpc_flow_logs_config.name': request.vpcFlowLogsConfig!.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.updateVpcFlowLogsConfig( + request, + options, + callback + ); + } + /** + * Check the status of the long running operation returned by `updateVpcFlowLogsConfig()`. + * @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 {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vpc_flow_logs_service.update_vpc_flow_logs_config.js + * region_tag:networkmanagement_v1_generated_VpcFlowLogsService_UpdateVpcFlowLogsConfig_async + */ + async checkUpdateVpcFlowLogsConfigProgress( + name: string + ): Promise< + LROperation< + protos.google.cloud.networkmanagement.v1.VpcFlowLogsConfig, + protos.google.cloud.networkmanagement.v1.OperationMetadata + > + > { + const request = + new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( + {name} + ); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.updateVpcFlowLogsConfig, + this._gaxModule.createDefaultBackoffSettings() + ); + return decodeOperation as LROperation< + protos.google.cloud.networkmanagement.v1.VpcFlowLogsConfig, + protos.google.cloud.networkmanagement.v1.OperationMetadata + >; + } + /** + * Deletes a specific `VpcFlowLogsConfig`. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. `VpcFlowLogsConfig` resource name using the form: + * `projects/{project_id}/locations/global/vpcFlowLogsConfigs/{vpc_flow_logs_config}` + * @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 {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vpc_flow_logs_service.delete_vpc_flow_logs_config.js + * region_tag:networkmanagement_v1_generated_VpcFlowLogsService_DeleteVpcFlowLogsConfig_async + */ + deleteVpcFlowLogsConfig( + request?: protos.google.cloud.networkmanagement.v1.IDeleteVpcFlowLogsConfigRequest, + options?: CallOptions + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networkmanagement.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; + deleteVpcFlowLogsConfig( + request: protos.google.cloud.networkmanagement.v1.IDeleteVpcFlowLogsConfigRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networkmanagement.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + deleteVpcFlowLogsConfig( + request: protos.google.cloud.networkmanagement.v1.IDeleteVpcFlowLogsConfigRequest, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networkmanagement.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + deleteVpcFlowLogsConfig( + request?: protos.google.cloud.networkmanagement.v1.IDeleteVpcFlowLogsConfigRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networkmanagement.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networkmanagement.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networkmanagement.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.deleteVpcFlowLogsConfig( + request, + options, + callback + ); + } + /** + * Check the status of the long running operation returned by `deleteVpcFlowLogsConfig()`. + * @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 {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vpc_flow_logs_service.delete_vpc_flow_logs_config.js + * region_tag:networkmanagement_v1_generated_VpcFlowLogsService_DeleteVpcFlowLogsConfig_async + */ + async checkDeleteVpcFlowLogsConfigProgress( + name: string + ): Promise< + LROperation< + protos.google.protobuf.Empty, + protos.google.cloud.networkmanagement.v1.OperationMetadata + > + > { + const request = + new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( + {name} + ); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.deleteVpcFlowLogsConfig, + this._gaxModule.createDefaultBackoffSettings() + ); + return decodeOperation as LROperation< + protos.google.protobuf.Empty, + protos.google.cloud.networkmanagement.v1.OperationMetadata + >; + } + /** + * Lists all `VpcFlowLogsConfigs` in a given project. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource of the VpcFlowLogsConfig: + * `projects/{project_id}/locations/global` + * @param {number} [request.pageSize] + * Optional. Number of `VpcFlowLogsConfigs` to return. + * @param {string} [request.pageToken] + * Optional. Page token from an earlier query, as returned in + * `next_page_token`. + * @param {string} [request.filter] + * Optional. Lists the `VpcFlowLogsConfigs` that match the filter expression. + * A filter expression must use the supported [CEL logic operators] + * (https://cloud.google.com/vpc/docs/about-flow-logs-records#supported_cel_logic_operators). + * @param {string} [request.orderBy] + * Optional. Field to use to sort the list. + * @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 {@link protos.google.cloud.networkmanagement.v1.VpcFlowLogsConfig|VpcFlowLogsConfig}. + * 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 `listVpcFlowLogsConfigsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listVpcFlowLogsConfigs( + request?: protos.google.cloud.networkmanagement.v1.IListVpcFlowLogsConfigsRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.networkmanagement.v1.IVpcFlowLogsConfig[], + protos.google.cloud.networkmanagement.v1.IListVpcFlowLogsConfigsRequest | null, + protos.google.cloud.networkmanagement.v1.IListVpcFlowLogsConfigsResponse, + ] + >; + listVpcFlowLogsConfigs( + request: protos.google.cloud.networkmanagement.v1.IListVpcFlowLogsConfigsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.networkmanagement.v1.IListVpcFlowLogsConfigsRequest, + | protos.google.cloud.networkmanagement.v1.IListVpcFlowLogsConfigsResponse + | null + | undefined, + protos.google.cloud.networkmanagement.v1.IVpcFlowLogsConfig + > + ): void; + listVpcFlowLogsConfigs( + request: protos.google.cloud.networkmanagement.v1.IListVpcFlowLogsConfigsRequest, + callback: PaginationCallback< + protos.google.cloud.networkmanagement.v1.IListVpcFlowLogsConfigsRequest, + | protos.google.cloud.networkmanagement.v1.IListVpcFlowLogsConfigsResponse + | null + | undefined, + protos.google.cloud.networkmanagement.v1.IVpcFlowLogsConfig + > + ): void; + listVpcFlowLogsConfigs( + request?: protos.google.cloud.networkmanagement.v1.IListVpcFlowLogsConfigsRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< + protos.google.cloud.networkmanagement.v1.IListVpcFlowLogsConfigsRequest, + | protos.google.cloud.networkmanagement.v1.IListVpcFlowLogsConfigsResponse + | null + | undefined, + protos.google.cloud.networkmanagement.v1.IVpcFlowLogsConfig + >, + callback?: PaginationCallback< + protos.google.cloud.networkmanagement.v1.IListVpcFlowLogsConfigsRequest, + | protos.google.cloud.networkmanagement.v1.IListVpcFlowLogsConfigsResponse + | null + | undefined, + protos.google.cloud.networkmanagement.v1.IVpcFlowLogsConfig + > + ): Promise< + [ + protos.google.cloud.networkmanagement.v1.IVpcFlowLogsConfig[], + protos.google.cloud.networkmanagement.v1.IListVpcFlowLogsConfigsRequest | null, + protos.google.cloud.networkmanagement.v1.IListVpcFlowLogsConfigsResponse, + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.listVpcFlowLogsConfigs( + 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 of the VpcFlowLogsConfig: + * `projects/{project_id}/locations/global` + * @param {number} [request.pageSize] + * Optional. Number of `VpcFlowLogsConfigs` to return. + * @param {string} [request.pageToken] + * Optional. Page token from an earlier query, as returned in + * `next_page_token`. + * @param {string} [request.filter] + * Optional. Lists the `VpcFlowLogsConfigs` that match the filter expression. + * A filter expression must use the supported [CEL logic operators] + * (https://cloud.google.com/vpc/docs/about-flow-logs-records#supported_cel_logic_operators). + * @param {string} [request.orderBy] + * Optional. Field to use to sort the list. + * @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 {@link protos.google.cloud.networkmanagement.v1.VpcFlowLogsConfig|VpcFlowLogsConfig} 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 `listVpcFlowLogsConfigsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listVpcFlowLogsConfigsStream( + request?: protos.google.cloud.networkmanagement.v1.IListVpcFlowLogsConfigsRequest, + options?: CallOptions + ): Transform { + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listVpcFlowLogsConfigs']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listVpcFlowLogsConfigs.createStream( + this.innerApiCalls.listVpcFlowLogsConfigs as GaxCall, + request, + callSettings + ); + } + + /** + * Equivalent to `listVpcFlowLogsConfigs`, 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 of the VpcFlowLogsConfig: + * `projects/{project_id}/locations/global` + * @param {number} [request.pageSize] + * Optional. Number of `VpcFlowLogsConfigs` to return. + * @param {string} [request.pageToken] + * Optional. Page token from an earlier query, as returned in + * `next_page_token`. + * @param {string} [request.filter] + * Optional. Lists the `VpcFlowLogsConfigs` that match the filter expression. + * A filter expression must use the supported [CEL logic operators] + * (https://cloud.google.com/vpc/docs/about-flow-logs-records#supported_cel_logic_operators). + * @param {string} [request.orderBy] + * Optional. Field to use to sort the list. + * @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 {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link protos.google.cloud.networkmanagement.v1.VpcFlowLogsConfig|VpcFlowLogsConfig}. 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 {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vpc_flow_logs_service.list_vpc_flow_logs_configs.js + * region_tag:networkmanagement_v1_generated_VpcFlowLogsService_ListVpcFlowLogsConfigs_async + */ + listVpcFlowLogsConfigsAsync( + request?: protos.google.cloud.networkmanagement.v1.IListVpcFlowLogsConfigsRequest, + options?: CallOptions + ): AsyncIterable { + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listVpcFlowLogsConfigs']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listVpcFlowLogsConfigs.asyncIterate( + this.innerApiCalls['listVpcFlowLogsConfigs'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + /** + * Gets the access control policy for a resource. Returns an empty policy + * if the resource exists and does not have a policy set. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.resource + * REQUIRED: The resource for which the policy is being requested. + * See the operation documentation for the appropriate value for this field. + * @param {Object} [request.options] + * OPTIONAL: A `GetPolicyOptions` object for specifying options to + * `GetIamPolicy`. This field is only used by Cloud IAM. + * + * This object should have the same structure as {@link google.iam.v1.GetPolicyOptions | GetPolicyOptions}. + * @param {Object} [options] + * Optional parameters. You can override the default settings for this call, e.g, timeout, + * retries, paginations, etc. See {@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html | gax.CallOptions} for the details. + * @param {function(?Error, ?Object)} [callback] + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing {@link google.iam.v1.Policy | Policy}. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link google.iam.v1.Policy | Policy}. + * The promise has a method named "cancel" which cancels the ongoing API call. + */ + getIamPolicy( + request: IamProtos.google.iam.v1.GetIamPolicyRequest, + options?: + | gax.CallOptions + | Callback< + IamProtos.google.iam.v1.Policy, + IamProtos.google.iam.v1.GetIamPolicyRequest | null | undefined, + {} | null | undefined + >, + callback?: Callback< + IamProtos.google.iam.v1.Policy, + IamProtos.google.iam.v1.GetIamPolicyRequest | null | undefined, + {} | null | undefined + > + ): Promise<[IamProtos.google.iam.v1.Policy]> { + return this.iamClient.getIamPolicy(request, options, callback); + } + + /** + * Returns permissions that a caller has on the specified resource. If the + * resource does not exist, this will return an empty set of + * permissions, not a NOT_FOUND error. + * + * Note: This operation is designed to be used for building + * permission-aware UIs and command-line tools, not for authorization + * checking. This operation may "fail open" without warning. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.resource + * REQUIRED: The resource for which the policy detail is being requested. + * See the operation documentation for the appropriate value for this field. + * @param {string[]} request.permissions + * The set of permissions to check for the `resource`. Permissions with + * wildcards (such as '*' or 'storage.*') are not allowed. For more + * information see {@link https://cloud.google.com/iam/docs/overview#permissions | IAM Overview }. + * @param {Object} [options] + * Optional parameters. You can override the default settings for this call, e.g, timeout, + * retries, paginations, etc. See {@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html | gax.CallOptions} for the details. + * @param {function(?Error, ?Object)} [callback] + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing {@link google.iam.v1.TestIamPermissionsResponse | TestIamPermissionsResponse}. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link google.iam.v1.TestIamPermissionsResponse | TestIamPermissionsResponse}. + * The promise has a method named "cancel" which cancels the ongoing API call. + */ + setIamPolicy( + request: IamProtos.google.iam.v1.SetIamPolicyRequest, + options?: + | gax.CallOptions + | Callback< + IamProtos.google.iam.v1.Policy, + IamProtos.google.iam.v1.SetIamPolicyRequest | null | undefined, + {} | null | undefined + >, + callback?: Callback< + IamProtos.google.iam.v1.Policy, + IamProtos.google.iam.v1.SetIamPolicyRequest | null | undefined, + {} | null | undefined + > + ): Promise<[IamProtos.google.iam.v1.Policy]> { + return this.iamClient.setIamPolicy(request, options, callback); + } + + /** + * Returns permissions that a caller has on the specified resource. If the + * resource does not exist, this will return an empty set of + * permissions, not a NOT_FOUND error. + * + * Note: This operation is designed to be used for building + * permission-aware UIs and command-line tools, not for authorization + * checking. This operation may "fail open" without warning. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.resource + * REQUIRED: The resource for which the policy detail is being requested. + * See the operation documentation for the appropriate value for this field. + * @param {string[]} request.permissions + * The set of permissions to check for the `resource`. Permissions with + * wildcards (such as '*' or 'storage.*') are not allowed. For more + * information see {@link https://cloud.google.com/iam/docs/overview#permissions | IAM Overview }. + * @param {Object} [options] + * Optional parameters. You can override the default settings for this call, e.g, timeout, + * retries, paginations, etc. See {@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html | gax.CallOptions} for the details. + * @param {function(?Error, ?Object)} [callback] + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing {@link google.iam.v1.TestIamPermissionsResponse | TestIamPermissionsResponse}. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link google.iam.v1.TestIamPermissionsResponse | TestIamPermissionsResponse}. + * The promise has a method named "cancel" which cancels the ongoing API call. + * + */ + testIamPermissions( + request: IamProtos.google.iam.v1.TestIamPermissionsRequest, + options?: + | gax.CallOptions + | Callback< + IamProtos.google.iam.v1.TestIamPermissionsResponse, + IamProtos.google.iam.v1.TestIamPermissionsRequest | null | undefined, + {} | null | undefined + >, + callback?: Callback< + IamProtos.google.iam.v1.TestIamPermissionsResponse, + IamProtos.google.iam.v1.TestIamPermissionsRequest | null | undefined, + {} | null | undefined + > + ): Promise<[IamProtos.google.iam.v1.TestIamPermissionsResponse]> { + return this.iamClient.testIamPermissions(request, options, callback); + } + + /** + * Gets information about a location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Resource name for the location. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html | CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link google.cloud.location.Location | Location}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example + * ``` + * const [response] = await client.getLocation(request); + * ``` + */ + getLocation( + request: LocationProtos.google.cloud.location.IGetLocationRequest, + options?: + | gax.CallOptions + | Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + > + ): Promise { + return this.locationsClient.getLocation(request, options, callback); + } + + /** + * Lists information about the supported locations for this service. Returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * The resource that owns the locations collection, if applicable. + * @param {string} request.filter + * The standard list filter. + * @param {number} request.pageSize + * The standard list page size. + * @param {string} request.pageToken + * The standard list page token. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link google.cloud.location.Location | Location}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example + * ``` + * const iterable = client.listLocationsAsync(request); + * for await (const response of iterable) { + * // process response + * } + * ``` + */ + listLocationsAsync( + request: LocationProtos.google.cloud.location.IListLocationsRequest, + options?: CallOptions + ): AsyncIterable { + return this.locationsClient.listLocationsAsync(request, options); + } + + /** + * Gets the latest state of a long-running operation. Clients can use this + * method to poll the operation result at intervals as recommended by the API + * service. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See {@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} + * for the details. + * @param {function(?Error, ?Object)=} callback + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing + * {@link google.longrunning.Operation | google.longrunning.Operation}. + * @return {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * {@link google.longrunning.Operation | google.longrunning.Operation}. + * The promise has a method named "cancel" which cancels the ongoing API call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * const name = ''; + * const [response] = await client.getOperation({name}); + * // doThingsWith(response) + * ``` + */ + getOperation( + request: protos.google.longrunning.GetOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.longrunning.Operation, + protos.google.longrunning.GetOperationRequest, + {} | null | undefined + >, + callback?: Callback< + protos.google.longrunning.Operation, + protos.google.longrunning.GetOperationRequest, + {} | null | undefined + > + ): Promise<[protos.google.longrunning.Operation]> { + return this.operationsClient.getOperation(request, options, callback); + } + /** + * Lists operations that match the specified filter in the request. If the + * server doesn't support this method, it returns `UNIMPLEMENTED`. Returns an iterable object. + * + * For-await-of syntax is used with the iterable to recursively get response element on-demand. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation collection. + * @param {string} request.filter - The standard list filter. + * @param {number=} request.pageSize - + * The maximum number of resources contained in the underlying API + * response. If page streaming is performed per-resource, this + * parameter does not affect the return value. If page streaming is + * performed per-page, this determines the maximum number of + * resources in a page. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See {@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} for the + * details. + * @returns {Object} + * An iterable Object that conforms to {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | iteration protocols}. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * for await (const response of client.listOperationsAsync(request)); + * // doThingsWith(response) + * ``` + */ + listOperationsAsync( + request: protos.google.longrunning.ListOperationsRequest, + options?: gax.CallOptions + ): AsyncIterable { + return this.operationsClient.listOperationsAsync(request, options); + } + /** + * Starts asynchronous cancellation on a long-running operation. The server + * makes a best effort to cancel the operation, but success is not + * guaranteed. If the server doesn't support this method, it returns + * `google.rpc.Code.UNIMPLEMENTED`. Clients can use + * {@link Operations.GetOperation} or + * other methods to check whether the cancellation succeeded or whether the + * operation completed despite cancellation. On successful cancellation, + * the operation is not deleted; instead, it becomes an operation with + * an {@link Operation.error} value with a {@link google.rpc.Status.code} of + * 1, corresponding to `Code.CANCELLED`. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource to be cancelled. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See {@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} for the + * details. + * @param {function(?Error)=} callback + * The function which will be called with the result of the API call. + * @return {Promise} - The promise which resolves when API call finishes. + * The promise has a method named "cancel" which cancels the ongoing API + * call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * await client.cancelOperation({name: ''}); + * ``` + */ + cancelOperation( + request: protos.google.longrunning.CancelOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.CancelOperationRequest, + {} | undefined | null + >, + callback?: Callback< + protos.google.longrunning.CancelOperationRequest, + protos.google.protobuf.Empty, + {} | undefined | null + > + ): Promise { + return this.operationsClient.cancelOperation(request, options, callback); + } + + /** + * Deletes a long-running operation. This method indicates that the client is + * no longer interested in the operation result. It does not cancel the + * operation. If the server doesn't support this method, it returns + * `google.rpc.Code.UNIMPLEMENTED`. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource to be deleted. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See {@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} + * for the details. + * @param {function(?Error)=} callback + * The function which will be called with the result of the API call. + * @return {Promise} - The promise which resolves when API call finishes. + * The promise has a method named "cancel" which cancels the ongoing API + * call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * await client.deleteOperation({name: ''}); + * ``` + */ + deleteOperation( + request: protos.google.longrunning.DeleteOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.DeleteOperationRequest, + {} | null | undefined + >, + callback?: Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.DeleteOperationRequest, + {} | null | undefined + > + ): Promise { + return this.operationsClient.deleteOperation(request, options, callback); + } + + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified connectivityTest resource name string. + * + * @param {string} project + * @param {string} test + * @returns {string} Resource name string. + */ + connectivityTestPath(project: string, test: string) { + return this.pathTemplates.connectivityTestPathTemplate.render({ + project: project, + test: test, + }); + } + + /** + * Parse the project from ConnectivityTest resource. + * + * @param {string} connectivityTestName + * A fully-qualified path representing ConnectivityTest resource. + * @returns {string} A string representing the project. + */ + matchProjectFromConnectivityTestName(connectivityTestName: string) { + return this.pathTemplates.connectivityTestPathTemplate.match( + connectivityTestName + ).project; + } + + /** + * Parse the test from ConnectivityTest resource. + * + * @param {string} connectivityTestName + * A fully-qualified path representing ConnectivityTest resource. + * @returns {string} A string representing the test. + */ + matchTestFromConnectivityTestName(connectivityTestName: string) { + return this.pathTemplates.connectivityTestPathTemplate.match( + connectivityTestName + ).test; + } + + /** + * 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 project resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectPath(project: string) { + return this.pathTemplates.projectPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from Project resource. + * + * @param {string} projectName + * A fully-qualified path representing Project resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectName(projectName: string) { + return this.pathTemplates.projectPathTemplate.match(projectName).project; + } + + /** + * Return a fully-qualified vpcFlowLogsConfig resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} vpc_flow_logs_config + * @returns {string} Resource name string. + */ + vpcFlowLogsConfigPath( + project: string, + location: string, + vpcFlowLogsConfig: string + ) { + return this.pathTemplates.vpcFlowLogsConfigPathTemplate.render({ + project: project, + location: location, + vpc_flow_logs_config: vpcFlowLogsConfig, + }); + } + + /** + * Parse the project from VpcFlowLogsConfig resource. + * + * @param {string} vpcFlowLogsConfigName + * A fully-qualified path representing VpcFlowLogsConfig resource. + * @returns {string} A string representing the project. + */ + matchProjectFromVpcFlowLogsConfigName(vpcFlowLogsConfigName: string) { + return this.pathTemplates.vpcFlowLogsConfigPathTemplate.match( + vpcFlowLogsConfigName + ).project; + } + + /** + * Parse the location from VpcFlowLogsConfig resource. + * + * @param {string} vpcFlowLogsConfigName + * A fully-qualified path representing VpcFlowLogsConfig resource. + * @returns {string} A string representing the location. + */ + matchLocationFromVpcFlowLogsConfigName(vpcFlowLogsConfigName: string) { + return this.pathTemplates.vpcFlowLogsConfigPathTemplate.match( + vpcFlowLogsConfigName + ).location; + } + + /** + * Parse the vpc_flow_logs_config from VpcFlowLogsConfig resource. + * + * @param {string} vpcFlowLogsConfigName + * A fully-qualified path representing VpcFlowLogsConfig resource. + * @returns {string} A string representing the vpc_flow_logs_config. + */ + matchVpcFlowLogsConfigFromVpcFlowLogsConfigName( + vpcFlowLogsConfigName: string + ) { + return this.pathTemplates.vpcFlowLogsConfigPathTemplate.match( + vpcFlowLogsConfigName + ).vpc_flow_logs_config; + } + + /** + * Terminate the gRPC channel and close the client. + * + * The client will no longer be usable and all future behavior is undefined. + * @returns {Promise} A promise that resolves when the client is closed. + */ + close(): Promise { + if (this.vpcFlowLogsServiceStub && !this._terminated) { + return this.vpcFlowLogsServiceStub.then(stub => { + this._terminated = true; + stub.close(); + this.iamClient.close(); + this.locationsClient.close(); + this.operationsClient.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/packages/google-cloud-networkmanagement/src/v1/vpc_flow_logs_service_client_config.json b/packages/google-cloud-networkmanagement/src/v1/vpc_flow_logs_service_client_config.json new file mode 100644 index 00000000000..df8a4bc3eea --- /dev/null +++ b/packages/google-cloud-networkmanagement/src/v1/vpc_flow_logs_service_client_config.json @@ -0,0 +1,46 @@ +{ + "interfaces": { + "google.cloud.networkmanagement.v1.VpcFlowLogsService": { + "retry_codes": { + "non_idempotent": [], + "idempotent": [ + "DEADLINE_EXCEEDED", + "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 + } + }, + "methods": { + "ListVpcFlowLogsConfigs": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GetVpcFlowLogsConfig": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "CreateVpcFlowLogsConfig": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "UpdateVpcFlowLogsConfig": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "DeleteVpcFlowLogsConfig": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + } + } + } + } +} diff --git a/packages/google-cloud-networkmanagement/src/v1/vpc_flow_logs_service_proto_list.json b/packages/google-cloud-networkmanagement/src/v1/vpc_flow_logs_service_proto_list.json new file mode 100644 index 00000000000..e2a20fc586f --- /dev/null +++ b/packages/google-cloud-networkmanagement/src/v1/vpc_flow_logs_service_proto_list.json @@ -0,0 +1,7 @@ +[ + "../../protos/google/cloud/networkmanagement/v1/connectivity_test.proto", + "../../protos/google/cloud/networkmanagement/v1/reachability.proto", + "../../protos/google/cloud/networkmanagement/v1/trace.proto", + "../../protos/google/cloud/networkmanagement/v1/vpc_flow_logs.proto", + "../../protos/google/cloud/networkmanagement/v1/vpc_flow_logs_config.proto" +] diff --git a/packages/google-cloud-networkmanagement/system-test/fixtures/sample/src/index.js b/packages/google-cloud-networkmanagement/system-test/fixtures/sample/src/index.js index 22e3e4a0dd4..1e315134d52 100644 --- a/packages/google-cloud-networkmanagement/system-test/fixtures/sample/src/index.js +++ b/packages/google-cloud-networkmanagement/system-test/fixtures/sample/src/index.js @@ -22,6 +22,8 @@ const networkmanagement = require('@google-cloud/network-management'); function main() { const reachabilityServiceClient = new networkmanagement.ReachabilityServiceClient(); + const vpcFlowLogsServiceClient = + new networkmanagement.VpcFlowLogsServiceClient(); } main(); diff --git a/packages/google-cloud-networkmanagement/system-test/fixtures/sample/src/index.ts b/packages/google-cloud-networkmanagement/system-test/fixtures/sample/src/index.ts index ed01b8cbaab..ea58ec47196 100644 --- a/packages/google-cloud-networkmanagement/system-test/fixtures/sample/src/index.ts +++ b/packages/google-cloud-networkmanagement/system-test/fixtures/sample/src/index.ts @@ -16,7 +16,10 @@ // ** https://github.com/googleapis/gapic-generator-typescript ** // ** All changes to this file may be overwritten. ** -import {ReachabilityServiceClient} from '@google-cloud/network-management'; +import { + ReachabilityServiceClient, + VpcFlowLogsServiceClient, +} from '@google-cloud/network-management'; // check that the client class type name can be used function doStuffWithReachabilityServiceClient( @@ -24,11 +27,17 @@ function doStuffWithReachabilityServiceClient( ) { client.close(); } +function doStuffWithVpcFlowLogsServiceClient(client: VpcFlowLogsServiceClient) { + client.close(); +} function main() { // check that the client instance can be created const reachabilityServiceClient = new ReachabilityServiceClient(); doStuffWithReachabilityServiceClient(reachabilityServiceClient); + // check that the client instance can be created + const vpcFlowLogsServiceClient = new VpcFlowLogsServiceClient(); + doStuffWithVpcFlowLogsServiceClient(vpcFlowLogsServiceClient); } main(); diff --git a/packages/google-cloud-networkmanagement/test/gapic_reachability_service_v1.ts b/packages/google-cloud-networkmanagement/test/gapic_reachability_service_v1.ts index 81cc94a5a19..d3a992e3821 100644 --- a/packages/google-cloud-networkmanagement/test/gapic_reachability_service_v1.ts +++ b/packages/google-cloud-networkmanagement/test/gapic_reachability_service_v1.ts @@ -2686,5 +2686,84 @@ describe('v1.ReachabilityServiceClient', () => { ); }); }); + + describe('vpcFlowLogsConfig', () => { + const fakePath = '/rendered/path/vpcFlowLogsConfig'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + vpc_flow_logs_config: 'vpcFlowLogsConfigValue', + }; + const client = new reachabilityserviceModule.v1.ReachabilityServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + client.pathTemplates.vpcFlowLogsConfigPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.vpcFlowLogsConfigPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('vpcFlowLogsConfigPath', () => { + const result = client.vpcFlowLogsConfigPath( + 'projectValue', + 'locationValue', + 'vpcFlowLogsConfigValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.vpcFlowLogsConfigPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromVpcFlowLogsConfigName', () => { + const result = client.matchProjectFromVpcFlowLogsConfigName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.vpcFlowLogsConfigPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromVpcFlowLogsConfigName', () => { + const result = client.matchLocationFromVpcFlowLogsConfigName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.vpcFlowLogsConfigPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchVpcFlowLogsConfigFromVpcFlowLogsConfigName', () => { + const result = + client.matchVpcFlowLogsConfigFromVpcFlowLogsConfigName(fakePath); + assert.strictEqual(result, 'vpcFlowLogsConfigValue'); + assert( + ( + client.pathTemplates.vpcFlowLogsConfigPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); }); }); diff --git a/packages/google-cloud-networkmanagement/test/gapic_vpc_flow_logs_service_v1.ts b/packages/google-cloud-networkmanagement/test/gapic_vpc_flow_logs_service_v1.ts new file mode 100644 index 00000000000..cdf947f8413 --- /dev/null +++ b/packages/google-cloud-networkmanagement/test/gapic_vpc_flow_logs_service_v1.ts @@ -0,0 +1,2483 @@ +// Copyright 2025 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 vpcflowlogsserviceModule from '../src'; + +import {PassThrough} from 'stream'; + +import { + protobuf, + LROperation, + operationsProtos, + IamProtos, + LocationProtos, +} from 'google-gax'; + +// Dynamically loaded proto JSON is needed to get the type information +// to fill in default values for request objects +const root = protobuf.Root.fromJSON( + require('../protos/protos.json') +).resolveAll(); + +// eslint-disable-next-line @typescript-eslint/no-unused-vars +function getTypeDefaultValue(typeName: string, fields: string[]) { + let type = root.lookupType(typeName) as protobuf.Type; + for (const field of fields.slice(0, -1)) { + type = type.fields[field]?.resolvedType as protobuf.Type; + } + return type.fields[fields[fields.length - 1]]?.defaultValue; +} + +function generateSampleMessage(instance: T) { + const filledObject = ( + instance.constructor as typeof protobuf.Message + ).toObject(instance as protobuf.Message, {defaults: true}); + return (instance.constructor as typeof protobuf.Message).fromObject( + filledObject + ) as T; +} + +function stubSimpleCall(response?: ResponseType, error?: Error) { + return error + ? sinon.stub().rejects(error) + : sinon.stub().resolves([response]); +} + +function stubSimpleCallWithCallback( + response?: ResponseType, + error?: Error +) { + return error + ? sinon.stub().callsArgWith(2, error) + : sinon.stub().callsArgWith(2, null, response); +} + +function stubLongRunningCall( + response?: ResponseType, + callError?: Error, + lroError?: Error +) { + const innerStub = lroError + ? sinon.stub().rejects(lroError) + : sinon.stub().resolves([response]); + const mockOperation = { + promise: innerStub, + }; + return callError + ? sinon.stub().rejects(callError) + : sinon.stub().resolves([mockOperation]); +} + +function stubLongRunningCallWithCallback( + response?: ResponseType, + callError?: Error, + lroError?: Error +) { + const innerStub = lroError + ? sinon.stub().rejects(lroError) + : sinon.stub().resolves([response]); + const mockOperation = { + promise: innerStub, + }; + return callError + ? sinon.stub().callsArgWith(2, callError) + : sinon.stub().callsArgWith(2, null, mockOperation); +} + +function stubPageStreamingCall( + responses?: ResponseType[], + error?: Error +) { + const pagingStub = sinon.stub(); + if (responses) { + for (let i = 0; i < responses.length; ++i) { + pagingStub.onCall(i).callsArgWith(2, null, responses[i]); + } + } + const transformStub = error + ? sinon.stub().callsArgWith(2, error) + : pagingStub; + const mockStream = new PassThrough({ + objectMode: true, + transform: transformStub, + }); + // trigger as many responses as needed + if (responses) { + for (let i = 0; i < responses.length; ++i) { + setImmediate(() => { + mockStream.write({}); + }); + } + setImmediate(() => { + mockStream.end(); + }); + } else { + setImmediate(() => { + mockStream.write({}); + }); + setImmediate(() => { + mockStream.end(); + }); + } + return sinon.stub().returns(mockStream); +} + +function stubAsyncIterationCall( + responses?: ResponseType[], + error?: Error +) { + let counter = 0; + const asyncIterable = { + [Symbol.asyncIterator]() { + return { + async next() { + if (error) { + return Promise.reject(error); + } + if (counter >= responses!.length) { + return Promise.resolve({done: true, value: undefined}); + } + return Promise.resolve({done: false, value: responses![counter++]}); + }, + }; + }, + }; + return sinon.stub().returns(asyncIterable); +} + +describe('v1.VpcFlowLogsServiceClient', () => { + describe('Common methods', () => { + it('has apiEndpoint', () => { + const client = new vpcflowlogsserviceModule.v1.VpcFlowLogsServiceClient(); + const apiEndpoint = client.apiEndpoint; + assert.strictEqual(apiEndpoint, 'networkmanagement.googleapis.com'); + }); + + it('has universeDomain', () => { + const client = new vpcflowlogsserviceModule.v1.VpcFlowLogsServiceClient(); + const universeDomain = client.universeDomain; + assert.strictEqual(universeDomain, 'googleapis.com'); + }); + + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + it('throws DeprecationWarning if static servicePath is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const servicePath = + vpcflowlogsserviceModule.v1.VpcFlowLogsServiceClient.servicePath; + assert.strictEqual(servicePath, 'networkmanagement.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + + it('throws DeprecationWarning if static apiEndpoint is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const apiEndpoint = + vpcflowlogsserviceModule.v1.VpcFlowLogsServiceClient.apiEndpoint; + assert.strictEqual(apiEndpoint, 'networkmanagement.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + } + it('sets apiEndpoint according to universe domain camelCase', () => { + const client = new vpcflowlogsserviceModule.v1.VpcFlowLogsServiceClient({ + universeDomain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'networkmanagement.example.com'); + }); + + it('sets apiEndpoint according to universe domain snakeCase', () => { + const client = new vpcflowlogsserviceModule.v1.VpcFlowLogsServiceClient({ + universe_domain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'networkmanagement.example.com'); + }); + + if (typeof process === 'object' && 'env' in process) { + describe('GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable', () => { + it('sets apiEndpoint from environment variable', () => { + const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; + const client = + new vpcflowlogsserviceModule.v1.VpcFlowLogsServiceClient(); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'networkmanagement.example.com'); + if (saved) { + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; + } else { + delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + } + }); + + it('value configured in code has priority over environment variable', () => { + const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; + const client = + new vpcflowlogsserviceModule.v1.VpcFlowLogsServiceClient({ + universeDomain: 'configured.example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual( + servicePath, + 'networkmanagement.configured.example.com' + ); + if (saved) { + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; + } else { + delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + } + }); + }); + } + it('does not allow setting both universeDomain and universe_domain', () => { + assert.throws(() => { + new vpcflowlogsserviceModule.v1.VpcFlowLogsServiceClient({ + universe_domain: 'example.com', + universeDomain: 'example.net', + }); + }); + }); + + it('has port', () => { + const port = vpcflowlogsserviceModule.v1.VpcFlowLogsServiceClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new vpcflowlogsserviceModule.v1.VpcFlowLogsServiceClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new vpcflowlogsserviceModule.v1.VpcFlowLogsServiceClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new vpcflowlogsserviceModule.v1.VpcFlowLogsServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.vpcFlowLogsServiceStub, undefined); + await client.initialize(); + assert(client.vpcFlowLogsServiceStub); + }); + + it('has close method for the initialized client', done => { + const client = new vpcflowlogsserviceModule.v1.VpcFlowLogsServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.vpcFlowLogsServiceStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = new vpcflowlogsserviceModule.v1.VpcFlowLogsServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.vpcFlowLogsServiceStub, undefined); + client.close().then(() => { + done(); + }); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new vpcflowlogsserviceModule.v1.VpcFlowLogsServiceClient({ + 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 vpcflowlogsserviceModule.v1.VpcFlowLogsServiceClient({ + 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('getVpcFlowLogsConfig', () => { + it('invokes getVpcFlowLogsConfig without error', async () => { + const client = new vpcflowlogsserviceModule.v1.VpcFlowLogsServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networkmanagement.v1.GetVpcFlowLogsConfigRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networkmanagement.v1.GetVpcFlowLogsConfigRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.networkmanagement.v1.VpcFlowLogsConfig() + ); + client.innerApiCalls.getVpcFlowLogsConfig = + stubSimpleCall(expectedResponse); + const [response] = await client.getVpcFlowLogsConfig(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getVpcFlowLogsConfig as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getVpcFlowLogsConfig as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getVpcFlowLogsConfig without error using callback', async () => { + const client = new vpcflowlogsserviceModule.v1.VpcFlowLogsServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networkmanagement.v1.GetVpcFlowLogsConfigRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networkmanagement.v1.GetVpcFlowLogsConfigRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.networkmanagement.v1.VpcFlowLogsConfig() + ); + client.innerApiCalls.getVpcFlowLogsConfig = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getVpcFlowLogsConfig( + request, + ( + err?: Error | null, + result?: protos.google.cloud.networkmanagement.v1.IVpcFlowLogsConfig | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getVpcFlowLogsConfig as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getVpcFlowLogsConfig as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getVpcFlowLogsConfig with error', async () => { + const client = new vpcflowlogsserviceModule.v1.VpcFlowLogsServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networkmanagement.v1.GetVpcFlowLogsConfigRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networkmanagement.v1.GetVpcFlowLogsConfigRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getVpcFlowLogsConfig = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.getVpcFlowLogsConfig(request), expectedError); + const actualRequest = ( + client.innerApiCalls.getVpcFlowLogsConfig as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getVpcFlowLogsConfig as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getVpcFlowLogsConfig with closed client', async () => { + const client = new vpcflowlogsserviceModule.v1.VpcFlowLogsServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networkmanagement.v1.GetVpcFlowLogsConfigRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networkmanagement.v1.GetVpcFlowLogsConfigRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getVpcFlowLogsConfig(request), expectedError); + }); + }); + + describe('createVpcFlowLogsConfig', () => { + it('invokes createVpcFlowLogsConfig without error', async () => { + const client = new vpcflowlogsserviceModule.v1.VpcFlowLogsServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networkmanagement.v1.CreateVpcFlowLogsConfigRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networkmanagement.v1.CreateVpcFlowLogsConfigRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createVpcFlowLogsConfig = + stubLongRunningCall(expectedResponse); + const [operation] = await client.createVpcFlowLogsConfig(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createVpcFlowLogsConfig as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createVpcFlowLogsConfig as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createVpcFlowLogsConfig without error using callback', async () => { + const client = new vpcflowlogsserviceModule.v1.VpcFlowLogsServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networkmanagement.v1.CreateVpcFlowLogsConfigRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networkmanagement.v1.CreateVpcFlowLogsConfigRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createVpcFlowLogsConfig = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createVpcFlowLogsConfig( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.networkmanagement.v1.IVpcFlowLogsConfig, + protos.google.cloud.networkmanagement.v1.IOperationMetadata + > | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.networkmanagement.v1.IVpcFlowLogsConfig, + protos.google.cloud.networkmanagement.v1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createVpcFlowLogsConfig as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createVpcFlowLogsConfig as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createVpcFlowLogsConfig with call error', async () => { + const client = new vpcflowlogsserviceModule.v1.VpcFlowLogsServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networkmanagement.v1.CreateVpcFlowLogsConfigRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networkmanagement.v1.CreateVpcFlowLogsConfigRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createVpcFlowLogsConfig = stubLongRunningCall( + undefined, + expectedError + ); + await assert.rejects( + client.createVpcFlowLogsConfig(request), + expectedError + ); + const actualRequest = ( + client.innerApiCalls.createVpcFlowLogsConfig as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createVpcFlowLogsConfig as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createVpcFlowLogsConfig with LRO error', async () => { + const client = new vpcflowlogsserviceModule.v1.VpcFlowLogsServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networkmanagement.v1.CreateVpcFlowLogsConfigRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networkmanagement.v1.CreateVpcFlowLogsConfigRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createVpcFlowLogsConfig = stubLongRunningCall( + undefined, + undefined, + expectedError + ); + const [operation] = await client.createVpcFlowLogsConfig(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.createVpcFlowLogsConfig as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createVpcFlowLogsConfig as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkCreateVpcFlowLogsConfigProgress without error', async () => { + const client = new vpcflowlogsserviceModule.v1.VpcFlowLogsServiceClient({ + 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.checkCreateVpcFlowLogsConfigProgress( + expectedResponse.name + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkCreateVpcFlowLogsConfigProgress with error', async () => { + const client = new vpcflowlogsserviceModule.v1.VpcFlowLogsServiceClient({ + 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.checkCreateVpcFlowLogsConfigProgress(''), + expectedError + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('updateVpcFlowLogsConfig', () => { + it('invokes updateVpcFlowLogsConfig without error', async () => { + const client = new vpcflowlogsserviceModule.v1.VpcFlowLogsServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networkmanagement.v1.UpdateVpcFlowLogsConfigRequest() + ); + request.vpcFlowLogsConfig ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networkmanagement.v1.UpdateVpcFlowLogsConfigRequest', + ['vpcFlowLogsConfig', 'name'] + ); + request.vpcFlowLogsConfig.name = defaultValue1; + const expectedHeaderRequestParams = `vpc_flow_logs_config.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.updateVpcFlowLogsConfig = + stubLongRunningCall(expectedResponse); + const [operation] = await client.updateVpcFlowLogsConfig(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateVpcFlowLogsConfig as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateVpcFlowLogsConfig as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateVpcFlowLogsConfig without error using callback', async () => { + const client = new vpcflowlogsserviceModule.v1.VpcFlowLogsServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networkmanagement.v1.UpdateVpcFlowLogsConfigRequest() + ); + request.vpcFlowLogsConfig ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networkmanagement.v1.UpdateVpcFlowLogsConfigRequest', + ['vpcFlowLogsConfig', 'name'] + ); + request.vpcFlowLogsConfig.name = defaultValue1; + const expectedHeaderRequestParams = `vpc_flow_logs_config.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.updateVpcFlowLogsConfig = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateVpcFlowLogsConfig( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.networkmanagement.v1.IVpcFlowLogsConfig, + protos.google.cloud.networkmanagement.v1.IOperationMetadata + > | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.networkmanagement.v1.IVpcFlowLogsConfig, + protos.google.cloud.networkmanagement.v1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateVpcFlowLogsConfig as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateVpcFlowLogsConfig as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateVpcFlowLogsConfig with call error', async () => { + const client = new vpcflowlogsserviceModule.v1.VpcFlowLogsServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networkmanagement.v1.UpdateVpcFlowLogsConfigRequest() + ); + request.vpcFlowLogsConfig ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networkmanagement.v1.UpdateVpcFlowLogsConfigRequest', + ['vpcFlowLogsConfig', 'name'] + ); + request.vpcFlowLogsConfig.name = defaultValue1; + const expectedHeaderRequestParams = `vpc_flow_logs_config.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateVpcFlowLogsConfig = stubLongRunningCall( + undefined, + expectedError + ); + await assert.rejects( + client.updateVpcFlowLogsConfig(request), + expectedError + ); + const actualRequest = ( + client.innerApiCalls.updateVpcFlowLogsConfig as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateVpcFlowLogsConfig as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateVpcFlowLogsConfig with LRO error', async () => { + const client = new vpcflowlogsserviceModule.v1.VpcFlowLogsServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networkmanagement.v1.UpdateVpcFlowLogsConfigRequest() + ); + request.vpcFlowLogsConfig ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networkmanagement.v1.UpdateVpcFlowLogsConfigRequest', + ['vpcFlowLogsConfig', 'name'] + ); + request.vpcFlowLogsConfig.name = defaultValue1; + const expectedHeaderRequestParams = `vpc_flow_logs_config.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateVpcFlowLogsConfig = stubLongRunningCall( + undefined, + undefined, + expectedError + ); + const [operation] = await client.updateVpcFlowLogsConfig(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.updateVpcFlowLogsConfig as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateVpcFlowLogsConfig as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkUpdateVpcFlowLogsConfigProgress without error', async () => { + const client = new vpcflowlogsserviceModule.v1.VpcFlowLogsServiceClient({ + 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.checkUpdateVpcFlowLogsConfigProgress( + expectedResponse.name + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkUpdateVpcFlowLogsConfigProgress with error', async () => { + const client = new vpcflowlogsserviceModule.v1.VpcFlowLogsServiceClient({ + 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.checkUpdateVpcFlowLogsConfigProgress(''), + expectedError + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('deleteVpcFlowLogsConfig', () => { + it('invokes deleteVpcFlowLogsConfig without error', async () => { + const client = new vpcflowlogsserviceModule.v1.VpcFlowLogsServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networkmanagement.v1.DeleteVpcFlowLogsConfigRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networkmanagement.v1.DeleteVpcFlowLogsConfigRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deleteVpcFlowLogsConfig = + stubLongRunningCall(expectedResponse); + const [operation] = await client.deleteVpcFlowLogsConfig(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteVpcFlowLogsConfig as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteVpcFlowLogsConfig as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteVpcFlowLogsConfig without error using callback', async () => { + const client = new vpcflowlogsserviceModule.v1.VpcFlowLogsServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networkmanagement.v1.DeleteVpcFlowLogsConfigRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networkmanagement.v1.DeleteVpcFlowLogsConfigRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deleteVpcFlowLogsConfig = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteVpcFlowLogsConfig( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networkmanagement.v1.IOperationMetadata + > | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const operation = (await promise) as LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.networkmanagement.v1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteVpcFlowLogsConfig as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteVpcFlowLogsConfig as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteVpcFlowLogsConfig with call error', async () => { + const client = new vpcflowlogsserviceModule.v1.VpcFlowLogsServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networkmanagement.v1.DeleteVpcFlowLogsConfigRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networkmanagement.v1.DeleteVpcFlowLogsConfigRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteVpcFlowLogsConfig = stubLongRunningCall( + undefined, + expectedError + ); + await assert.rejects( + client.deleteVpcFlowLogsConfig(request), + expectedError + ); + const actualRequest = ( + client.innerApiCalls.deleteVpcFlowLogsConfig as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteVpcFlowLogsConfig as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteVpcFlowLogsConfig with LRO error', async () => { + const client = new vpcflowlogsserviceModule.v1.VpcFlowLogsServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networkmanagement.v1.DeleteVpcFlowLogsConfigRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networkmanagement.v1.DeleteVpcFlowLogsConfigRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteVpcFlowLogsConfig = stubLongRunningCall( + undefined, + undefined, + expectedError + ); + const [operation] = await client.deleteVpcFlowLogsConfig(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.deleteVpcFlowLogsConfig as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteVpcFlowLogsConfig as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkDeleteVpcFlowLogsConfigProgress without error', async () => { + const client = new vpcflowlogsserviceModule.v1.VpcFlowLogsServiceClient({ + 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.checkDeleteVpcFlowLogsConfigProgress( + expectedResponse.name + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkDeleteVpcFlowLogsConfigProgress with error', async () => { + const client = new vpcflowlogsserviceModule.v1.VpcFlowLogsServiceClient({ + 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.checkDeleteVpcFlowLogsConfigProgress(''), + expectedError + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('listVpcFlowLogsConfigs', () => { + it('invokes listVpcFlowLogsConfigs without error', async () => { + const client = new vpcflowlogsserviceModule.v1.VpcFlowLogsServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networkmanagement.v1.ListVpcFlowLogsConfigsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networkmanagement.v1.ListVpcFlowLogsConfigsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.networkmanagement.v1.VpcFlowLogsConfig() + ), + generateSampleMessage( + new protos.google.cloud.networkmanagement.v1.VpcFlowLogsConfig() + ), + generateSampleMessage( + new protos.google.cloud.networkmanagement.v1.VpcFlowLogsConfig() + ), + ]; + client.innerApiCalls.listVpcFlowLogsConfigs = + stubSimpleCall(expectedResponse); + const [response] = await client.listVpcFlowLogsConfigs(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listVpcFlowLogsConfigs as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listVpcFlowLogsConfigs as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listVpcFlowLogsConfigs without error using callback', async () => { + const client = new vpcflowlogsserviceModule.v1.VpcFlowLogsServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networkmanagement.v1.ListVpcFlowLogsConfigsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networkmanagement.v1.ListVpcFlowLogsConfigsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.networkmanagement.v1.VpcFlowLogsConfig() + ), + generateSampleMessage( + new protos.google.cloud.networkmanagement.v1.VpcFlowLogsConfig() + ), + generateSampleMessage( + new protos.google.cloud.networkmanagement.v1.VpcFlowLogsConfig() + ), + ]; + client.innerApiCalls.listVpcFlowLogsConfigs = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listVpcFlowLogsConfigs( + request, + ( + err?: Error | null, + result?: + | protos.google.cloud.networkmanagement.v1.IVpcFlowLogsConfig[] + | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listVpcFlowLogsConfigs as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listVpcFlowLogsConfigs as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listVpcFlowLogsConfigs with error', async () => { + const client = new vpcflowlogsserviceModule.v1.VpcFlowLogsServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networkmanagement.v1.ListVpcFlowLogsConfigsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networkmanagement.v1.ListVpcFlowLogsConfigsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listVpcFlowLogsConfigs = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects( + client.listVpcFlowLogsConfigs(request), + expectedError + ); + const actualRequest = ( + client.innerApiCalls.listVpcFlowLogsConfigs as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listVpcFlowLogsConfigs as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listVpcFlowLogsConfigsStream without error', async () => { + const client = new vpcflowlogsserviceModule.v1.VpcFlowLogsServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networkmanagement.v1.ListVpcFlowLogsConfigsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networkmanagement.v1.ListVpcFlowLogsConfigsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.networkmanagement.v1.VpcFlowLogsConfig() + ), + generateSampleMessage( + new protos.google.cloud.networkmanagement.v1.VpcFlowLogsConfig() + ), + generateSampleMessage( + new protos.google.cloud.networkmanagement.v1.VpcFlowLogsConfig() + ), + ]; + client.descriptors.page.listVpcFlowLogsConfigs.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.listVpcFlowLogsConfigsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.networkmanagement.v1.VpcFlowLogsConfig[] = + []; + stream.on( + 'data', + ( + response: protos.google.cloud.networkmanagement.v1.VpcFlowLogsConfig + ) => { + 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.listVpcFlowLogsConfigs + .createStream as SinonStub + ) + .getCall(0) + .calledWith(client.innerApiCalls.listVpcFlowLogsConfigs, request) + ); + assert( + ( + client.descriptors.page.listVpcFlowLogsConfigs + .createStream as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listVpcFlowLogsConfigsStream with error', async () => { + const client = new vpcflowlogsserviceModule.v1.VpcFlowLogsServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networkmanagement.v1.ListVpcFlowLogsConfigsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networkmanagement.v1.ListVpcFlowLogsConfigsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listVpcFlowLogsConfigs.createStream = + stubPageStreamingCall(undefined, expectedError); + const stream = client.listVpcFlowLogsConfigsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.networkmanagement.v1.VpcFlowLogsConfig[] = + []; + stream.on( + 'data', + ( + response: protos.google.cloud.networkmanagement.v1.VpcFlowLogsConfig + ) => { + responses.push(response); + } + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + ( + client.descriptors.page.listVpcFlowLogsConfigs + .createStream as SinonStub + ) + .getCall(0) + .calledWith(client.innerApiCalls.listVpcFlowLogsConfigs, request) + ); + assert( + ( + client.descriptors.page.listVpcFlowLogsConfigs + .createStream as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listVpcFlowLogsConfigs without error', async () => { + const client = new vpcflowlogsserviceModule.v1.VpcFlowLogsServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networkmanagement.v1.ListVpcFlowLogsConfigsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networkmanagement.v1.ListVpcFlowLogsConfigsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.networkmanagement.v1.VpcFlowLogsConfig() + ), + generateSampleMessage( + new protos.google.cloud.networkmanagement.v1.VpcFlowLogsConfig() + ), + generateSampleMessage( + new protos.google.cloud.networkmanagement.v1.VpcFlowLogsConfig() + ), + ]; + client.descriptors.page.listVpcFlowLogsConfigs.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.networkmanagement.v1.IVpcFlowLogsConfig[] = + []; + const iterable = client.listVpcFlowLogsConfigsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.descriptors.page.listVpcFlowLogsConfigs + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert( + ( + client.descriptors.page.listVpcFlowLogsConfigs + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listVpcFlowLogsConfigs with error', async () => { + const client = new vpcflowlogsserviceModule.v1.VpcFlowLogsServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.networkmanagement.v1.ListVpcFlowLogsConfigsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.networkmanagement.v1.ListVpcFlowLogsConfigsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listVpcFlowLogsConfigs.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listVpcFlowLogsConfigsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.networkmanagement.v1.IVpcFlowLogsConfig[] = + []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.descriptors.page.listVpcFlowLogsConfigs + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert( + ( + client.descriptors.page.listVpcFlowLogsConfigs + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + describe('getIamPolicy', () => { + it('invokes getIamPolicy without error', async () => { + const client = new vpcflowlogsserviceModule.v1.VpcFlowLogsServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.GetIamPolicyRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.Policy() + ); + client.iamClient.getIamPolicy = stubSimpleCall(expectedResponse); + const response = await client.getIamPolicy(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.iamClient.getIamPolicy as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + it('invokes getIamPolicy without error using callback', async () => { + const client = new vpcflowlogsserviceModule.v1.VpcFlowLogsServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.GetIamPolicyRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.Policy() + ); + client.iamClient.getIamPolicy = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getIamPolicy( + request, + expectedOptions, + ( + err?: Error | null, + result?: IamProtos.google.iam.v1.Policy | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.iamClient.getIamPolicy as SinonStub).getCall(0)); + }); + it('invokes getIamPolicy with error', async () => { + const client = new vpcflowlogsserviceModule.v1.VpcFlowLogsServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.GetIamPolicyRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.iamClient.getIamPolicy = stubSimpleCall(undefined, expectedError); + await assert.rejects( + client.getIamPolicy(request, expectedOptions), + expectedError + ); + assert( + (client.iamClient.getIamPolicy as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + }); + describe('setIamPolicy', () => { + it('invokes setIamPolicy without error', async () => { + const client = new vpcflowlogsserviceModule.v1.VpcFlowLogsServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.SetIamPolicyRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.Policy() + ); + client.iamClient.setIamPolicy = stubSimpleCall(expectedResponse); + const response = await client.setIamPolicy(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.iamClient.setIamPolicy as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + it('invokes setIamPolicy without error using callback', async () => { + const client = new vpcflowlogsserviceModule.v1.VpcFlowLogsServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.SetIamPolicyRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.Policy() + ); + client.iamClient.setIamPolicy = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.setIamPolicy( + request, + expectedOptions, + ( + err?: Error | null, + result?: IamProtos.google.iam.v1.Policy | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.iamClient.setIamPolicy as SinonStub).getCall(0)); + }); + it('invokes setIamPolicy with error', async () => { + const client = new vpcflowlogsserviceModule.v1.VpcFlowLogsServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.SetIamPolicyRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.iamClient.setIamPolicy = stubSimpleCall(undefined, expectedError); + await assert.rejects( + client.setIamPolicy(request, expectedOptions), + expectedError + ); + assert( + (client.iamClient.setIamPolicy as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + }); + describe('testIamPermissions', () => { + it('invokes testIamPermissions without error', async () => { + const client = new vpcflowlogsserviceModule.v1.VpcFlowLogsServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.TestIamPermissionsRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.TestIamPermissionsResponse() + ); + client.iamClient.testIamPermissions = stubSimpleCall(expectedResponse); + const response = await client.testIamPermissions( + request, + expectedOptions + ); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.iamClient.testIamPermissions as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + it('invokes testIamPermissions without error using callback', async () => { + const client = new vpcflowlogsserviceModule.v1.VpcFlowLogsServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.TestIamPermissionsRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.TestIamPermissionsResponse() + ); + client.iamClient.testIamPermissions = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.testIamPermissions( + request, + expectedOptions, + ( + err?: Error | null, + result?: IamProtos.google.iam.v1.TestIamPermissionsResponse | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.iamClient.testIamPermissions as SinonStub).getCall(0)); + }); + it('invokes testIamPermissions with error', async () => { + const client = new vpcflowlogsserviceModule.v1.VpcFlowLogsServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.TestIamPermissionsRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.iamClient.testIamPermissions = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects( + client.testIamPermissions(request, expectedOptions), + expectedError + ); + assert( + (client.iamClient.testIamPermissions as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + }); + describe('getLocation', () => { + it('invokes getLocation without error', async () => { + const client = new vpcflowlogsserviceModule.v1.VpcFlowLogsServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = stubSimpleCall(expectedResponse); + const response = await client.getLocation(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.locationsClient.getLocation as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + it('invokes getLocation without error using callback', async () => { + const client = new vpcflowlogsserviceModule.v1.VpcFlowLogsServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getLocation( + request, + expectedOptions, + ( + err?: Error | null, + result?: LocationProtos.google.cloud.location.ILocation | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.locationsClient.getLocation as SinonStub).getCall(0)); + }); + it('invokes getLocation with error', async () => { + const client = new vpcflowlogsserviceModule.v1.VpcFlowLogsServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.locationsClient.getLocation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects( + client.getLocation(request, expectedOptions), + expectedError + ); + assert( + (client.locationsClient.getLocation as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + }); + describe('listLocationsAsync', () => { + it('uses async iteration with listLocations without error', async () => { + const client = new vpcflowlogsserviceModule.v1.VpcFlowLogsServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedResponse = [ + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + ]; + client.locationsClient.descriptors.page.listLocations.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + const iterable = client.listLocationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + it('uses async iteration with listLocations with error', async () => { + const client = new vpcflowlogsserviceModule.v1.VpcFlowLogsServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('expected'); + client.locationsClient.descriptors.page.listLocations.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listLocationsAsync(request); + await assert.rejects(async () => { + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + describe('getOperation', () => { + it('invokes getOperation without error', async () => { + const client = new vpcflowlogsserviceModule.v1.VpcFlowLogsServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const response = await client.getOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.operationsClient.getOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); + }); + it('invokes getOperation without error using callback', async () => { + const client = new vpcflowlogsserviceModule.v1.VpcFlowLogsServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + client.operationsClient.getOperation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.getOperation( + request, + undefined, + ( + err?: Error | null, + result?: operationsProtos.google.longrunning.Operation | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + it('invokes getOperation with error', async () => { + const client = new vpcflowlogsserviceModule.v1.VpcFlowLogsServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(async () => { + await client.getOperation(request); + }, expectedError); + assert( + (client.operationsClient.getOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); + }); + }); + describe('cancelOperation', () => { + it('invokes cancelOperation without error', async () => { + const client = new vpcflowlogsserviceModule.v1.VpcFlowLogsServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.cancelOperation = + stubSimpleCall(expectedResponse); + const response = await client.cancelOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.operationsClient.cancelOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); + }); + it('invokes cancelOperation without error using callback', async () => { + const client = new vpcflowlogsserviceModule.v1.VpcFlowLogsServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.cancelOperation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.cancelOperation( + request, + undefined, + ( + err?: Error | null, + result?: protos.google.protobuf.Empty | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.cancelOperation as SinonStub).getCall(0)); + }); + it('invokes cancelOperation with error', async () => { + const client = new vpcflowlogsserviceModule.v1.VpcFlowLogsServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.cancelOperation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(async () => { + await client.cancelOperation(request); + }, expectedError); + assert( + (client.operationsClient.cancelOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); + }); + }); + describe('deleteOperation', () => { + it('invokes deleteOperation without error', async () => { + const client = new vpcflowlogsserviceModule.v1.VpcFlowLogsServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.deleteOperation = + stubSimpleCall(expectedResponse); + const response = await client.deleteOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.operationsClient.deleteOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); + }); + it('invokes deleteOperation without error using callback', async () => { + const client = new vpcflowlogsserviceModule.v1.VpcFlowLogsServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.deleteOperation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.deleteOperation( + request, + undefined, + ( + err?: Error | null, + result?: protos.google.protobuf.Empty | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.deleteOperation as SinonStub).getCall(0)); + }); + it('invokes deleteOperation with error', async () => { + const client = new vpcflowlogsserviceModule.v1.VpcFlowLogsServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.deleteOperation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(async () => { + await client.deleteOperation(request); + }, expectedError); + assert( + (client.operationsClient.deleteOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); + }); + }); + describe('listOperationsAsync', () => { + it('uses async iteration with listOperations without error', async () => { + const client = new vpcflowlogsserviceModule.v1.VpcFlowLogsServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsRequest() + ); + const expectedResponse = [ + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + ]; + client.operationsClient.descriptor.listOperations.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = + []; + const iterable = client.operationsClient.listOperationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.operationsClient.descriptor.listOperations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + }); + it('uses async iteration with listOperations with error', async () => { + const client = new vpcflowlogsserviceModule.v1.VpcFlowLogsServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.descriptor.listOperations.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.operationsClient.listOperationsAsync(request); + await assert.rejects(async () => { + const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = + []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.operationsClient.descriptor.listOperations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + }); + }); + + describe('Path templates', () => { + describe('connectivityTest', () => { + const fakePath = '/rendered/path/connectivityTest'; + const expectedParameters = { + project: 'projectValue', + test: 'testValue', + }; + const client = new vpcflowlogsserviceModule.v1.VpcFlowLogsServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.connectivityTestPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.connectivityTestPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('connectivityTestPath', () => { + const result = client.connectivityTestPath('projectValue', 'testValue'); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.connectivityTestPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromConnectivityTestName', () => { + const result = client.matchProjectFromConnectivityTestName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.connectivityTestPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchTestFromConnectivityTestName', () => { + const result = client.matchTestFromConnectivityTestName(fakePath); + assert.strictEqual(result, 'testValue'); + assert( + (client.pathTemplates.connectivityTestPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('location', () => { + const fakePath = '/rendered/path/location'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + }; + const client = new vpcflowlogsserviceModule.v1.VpcFlowLogsServiceClient({ + 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('project', () => { + const fakePath = '/rendered/path/project'; + const expectedParameters = { + project: 'projectValue', + }; + const client = new vpcflowlogsserviceModule.v1.VpcFlowLogsServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectPath', () => { + const result = client.projectPath('projectValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.projectPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectName', () => { + const result = client.matchProjectFromProjectName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.projectPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('vpcFlowLogsConfig', () => { + const fakePath = '/rendered/path/vpcFlowLogsConfig'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + vpc_flow_logs_config: 'vpcFlowLogsConfigValue', + }; + const client = new vpcflowlogsserviceModule.v1.VpcFlowLogsServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.vpcFlowLogsConfigPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.vpcFlowLogsConfigPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('vpcFlowLogsConfigPath', () => { + const result = client.vpcFlowLogsConfigPath( + 'projectValue', + 'locationValue', + 'vpcFlowLogsConfigValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.vpcFlowLogsConfigPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromVpcFlowLogsConfigName', () => { + const result = client.matchProjectFromVpcFlowLogsConfigName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.vpcFlowLogsConfigPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromVpcFlowLogsConfigName', () => { + const result = client.matchLocationFromVpcFlowLogsConfigName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.vpcFlowLogsConfigPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchVpcFlowLogsConfigFromVpcFlowLogsConfigName', () => { + const result = + client.matchVpcFlowLogsConfigFromVpcFlowLogsConfigName(fakePath); + assert.strictEqual(result, 'vpcFlowLogsConfigValue'); + assert( + ( + client.pathTemplates.vpcFlowLogsConfigPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + }); +});